This commit is contained in:
Aaron Raimist 2021-02-27 20:02:26 -06:00
parent 2a2d42c08d
commit 97239d973e
No known key found for this signature in database
GPG Key ID: 37419210002890EF

View File

@ -32,21 +32,22 @@ const authProvider = {
// called when the user clicks on the logout button // called when the user clicks on the logout button
logout: () => { logout: () => {
console.log("logout"); console.log("logout");
const logout_api_url = localStorage.getItem("base_url") + "/_matrix/client/r0/logout"; const logout_api_url =
localStorage.getItem("base_url") + "/_matrix/client/r0/logout";
const token = localStorage.getItem("access_token"); const token = localStorage.getItem("access_token");
const options = { const options = {
method: "POST", method: "POST",
user: { user: {
authenticated: true, authenticated: true,
token: `Bearer ${token}`, token: `Bearer ${token}`,
} },
} };
return fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => { return fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => {
localStorage.removeItem("access_token"); localStorage.removeItem("access_token");
localStorage.removeItem("device_id"); localStorage.removeItem("device_id");
}); });
}, },
// called when the API returns an error // called when the API returns an error