Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: improving logut functionality

Ilian Sapundshiev62f02062976a
diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsx
index 3f4b2bc9f..96886cdd1 100644
--- a/app/components/WelcomePanel.tsx
+++ b/app/components/WelcomePanel.tsx
@@ -205,9 +205,28 @@ const WelcomePanel = (props: Props) => {
<ListItem
button
onClick={() => {
- const p = window.location.protocol + '//';
+ // const p = window.location.protocol + '//';
// @ts-ignore
- window.location = window.location.href.replace(p, p + 'log:out@');
+ // window.location = window.location.href.replace(p, p + 'log:out@');
+
+ const newHref = window.location.href.replace(
+ 'http://',
+ 'http://' + new Date().getTime() + '@'
+ );
+ let xmlhttp;
+ if (window.XMLHttpRequest) {
+ xmlhttp = new XMLHttpRequest();
+ } else {
+ // @ts-ignore
+ xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ xmlhttp.onreadystatechange = () => {
+ if (xmlhttp.readyState === 4) window.location.reload();
+ };
+ xmlhttp.open('GET', newHref, true);
+ xmlhttp.setRequestHeader('Authorization', 'Basic YXNkc2E6');
+ xmlhttp.send();
+ return false;
}}
>
<Button startIcon={<LogoutIcon />}>{i18n.t('core:Logout')}</Button>