Actually logout when the logout button is pressed so that old sessions get deleted
This commit is contained in:
parent
d69a07980f
commit
2a2d42c08d
@ -32,8 +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 token = localStorage.getItem("access_token");
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
method: "POST",
|
||||||
|
user: {
|
||||||
|
authenticated: true,
|
||||||
|
token: `Bearer ${token}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => {
|
||||||
localStorage.removeItem("access_token");
|
localStorage.removeItem("access_token");
|
||||||
return Promise.resolve();
|
localStorage.removeItem("device_id");
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// called when the API returns an error
|
// called when the API returns an error
|
||||||
checkError: ({ status }) => {
|
checkError: ({ status }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user