mirror of
https://github.com/discourse/discourse.git
synced 2025-01-26 15:13:16 +08:00
0134e41286
This cleans up an error condition where UI thinks a user is logged on but the user is not. If this happens user will be prompted to refresh.
17 lines
532 B
JavaScript
17 lines
532 B
JavaScript
export default function logout(siteSettings, keyValueStore) {
|
|
if (!siteSettings || !keyValueStore) {
|
|
const container = Discourse.__container__;
|
|
siteSettings = siteSettings || container.lookup('site-settings:main');
|
|
keyValueStore = keyValueStore || container.lookup('key-value-store:main');
|
|
}
|
|
|
|
keyValueStore.abandonLocal();
|
|
|
|
const redirect = siteSettings.logout_redirect;
|
|
if (Ember.isEmpty(redirect)) {
|
|
window.location.pathname = Discourse.getURL('/');
|
|
} else {
|
|
window.location.href = redirect;
|
|
}
|
|
}
|