fix: fix channel listing
`channelViewers` is now updated properly
This commit is contained in:
@@ -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));
|
||||
});
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user