Display error messages on form

two new strings need translating in lang/form.
This commit is contained in:
Harvey Tindall
2021-01-25 18:01:18 +00:00
parent 061945218a
commit 8af1c13d7e
9 changed files with 42 additions and 12 deletions
+3 -2
View File
@@ -67,7 +67,7 @@ export const _get = (url: string, data: Object, onreadystatechange: (req: XMLHtt
req.send(JSON.stringify(data));
};
export const _post = (url: string, data: Object, onreadystatechange: (req: XMLHttpRequest) => void, response?: boolean): void => {
export const _post = (url: string, data: Object, onreadystatechange: (req: XMLHttpRequest) => void, response?: boolean, statusHandler?: (req: XMLHttpRequest) => void): void => {
let req = new XMLHttpRequest();
req.open("POST", window.URLBase + url, true);
if (response) {
@@ -76,7 +76,8 @@ export const _post = (url: string, data: Object, onreadystatechange: (req: XMLHt
req.setRequestHeader("Authorization", "Bearer " + window.token);
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
req.onreadystatechange = () => {
if (req.status == 0) {
if (statusHandler) { statusHandler(req); }
else if (req.status == 0) {
window.notifications.connectionError();
return;
} else if (req.status == 401) {