fix: fix channel listing

`channelViewers` is now updated properly
This commit is contained in:
2023-02-13 23:09:31 +01:00
parent 071ae4545a
commit 89311aa4d8
2 changed files with 7 additions and 18 deletions

View File

@@ -11,19 +11,14 @@ const $get = (url: string, cb: Function): void => {
req.send(null);
};
const $post = (
url: string,
path: string,
data: any,
cb: (...args: any[]) => void
): void => {
const $post = (url: string, data: any, cb: (...args: any[]) => void): void => {
const req = new XMLHttpRequest();
req.onreadystatechange = () => {
if (req.readyState === 4 && req.status === 200) {
cb(JSON.parse(req.responseText));
}
};
req.open("POST", url + path);
req.open("POST", url);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.setRequestHeader("X-Requested-With", "XMLHttpRequest");
@@ -37,9 +32,9 @@ export default {
$get(url, (response) => resolve(response));
});
},
post: (url: string, path: string, data: Object): Promise<any> => {
post: (url: string, data: Object): Promise<any> => {
return new Promise((resolve) => {
$post(url, path, data, (response) => resolve(response));
$post(url, data, (response) => resolve(response));
});
},
};