fix invalidate all sessions

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2025-08-31 14:17:22 +02:00
parent d448ec025c
commit a0a197a8d9
+17 -3
View File
@@ -1867,11 +1867,25 @@ export class API {
* @returns
*/
invalidateSessions: async (userID = '') => {
let data = null;
if (userID) {
data = { userID };
return await postJSON(this.getPath(`/user/sessions/invalidate`), { userID });
}
return await postJSON(this.getPath(`/user/sessions/invalidate`), data);
const res = await fetch(this.getPath(`/user/sessions/invalidate`), {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
let body = {};
try {
body = await res.json();
} catch (e) {
body = {
success: false,
error: 'invalid JSON in response'
};
}
return newResponse(body.success, res.status, body.error, body.data);
}
};