Fix ajax errors on empty tables

This commit is contained in:
andryyy 2017-03-21 15:43:20 +01:00
parent 95f18f634b
commit e72a28ebf6

View File

@ -18,6 +18,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} }
} }
else {
echo '{}';
}
break; break;
case "mailbox_table_data": case "mailbox_table_data":
$domains = mailbox_get_domains(); $domains = mailbox_get_domains();
@ -37,6 +40,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} }
} }
else {
echo '{}';
}
break; break;
case "resource_table_data": case "resource_table_data":
$domains = mailbox_get_domains(); $domains = mailbox_get_domains();
@ -56,6 +62,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} }
} }
else {
echo '{}';
}
break; break;
case "domain_alias_table_data": case "domain_alias_table_data":
$domains = mailbox_get_domains(); $domains = mailbox_get_domains();
@ -75,6 +84,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} }
} }
else {
echo '{}';
}
break; break;
case "alias_table_data": case "alias_table_data":
$domains = array_merge(mailbox_get_domains(), mailbox_get_alias_domains()); $domains = array_merge(mailbox_get_domains(), mailbox_get_alias_domains());
@ -94,6 +106,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} }
} }
else {
echo '{}';
}
break; break;
case "get_mailbox_details": case "get_mailbox_details":
if (!isset($_GET['object'])) { return false; } if (!isset($_GET['object'])) { return false; }