Skip to content

Commit

Permalink
Reload browser page on logout to clear state
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed May 7, 2020
1 parent eb92efe commit 32dad4d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const run = (
ipcRenderer.send('clearCookies');
}

run(null, null, false);
history.go();
},
token,
username,
Expand Down
13 changes: 6 additions & 7 deletions lib/dialogs/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,22 @@ export class SettingsDialog extends Component<Props> {

showElectronWarningDialog = () => {
const dialog = __non_webpack_require__('electron').remote.dialog; // eslint-disable-line no-undef
dialog.showMessageBox(
{
dialog
.showMessageBox({
type: 'warning',
buttons: ['Delete Notes', 'Cancel', 'Visit Web App'],
title: 'Unsynced Notes Detected',
message:
'Logging out will delete any unsynced notes. You can verify your ' +
'synced notes by logging in to the Web App.',
},
(response) => {
})
.then(({ response }) => {
if (response === 0) {
this.signOut();
this.props.onSignOut();
} else if (response === 2) {
viewExternalUrl('https://app.simplenote.com');
}
}
);
});
};

showWebWarningDialog = () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type AppState = {
unsyncedNoteIds: T.EntityId[];
};

export const reducers = combineReducers<State, A.ActionType>({
const reducers = combineReducers<State, A.ActionType>({
appState: appState.reducer.bind(appState),
settings,
tags,
Expand Down
4 changes: 2 additions & 2 deletions lib/state/simperium/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Client } from 'simperium';

import debugFactory from 'debug';
import appState from '../../flux/app-state';
import actions from '../actions';

import { toggleSystemTag } from '../domain/notes';
Expand Down Expand Up @@ -67,7 +66,8 @@ export const initSimperium = (

switch (action.type) {
case 'LOGOUT':
return logout();
client.reset().then(() => logout());
return result;

case 'SET_SYSTEM_TAG':
noteBucket.update(
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/filter-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default function filterNotes(
notesArray: T.NoteEntity[] | null = null
) {
const {
data: { notes },
appState: { notes },
ui: { openedTag, searchQuery, showTrash },
} = state;

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"isolatedModules": true,
"esModuleInterop": true,
"types": ["dom", "jest"],
"typeRoots": ["./node_modules/@types", "./lib/typings"]
"typeRoots": ["./lib/typings", "./node_modules/@types"]
},
"include": ["lib/**/*"]
}

0 comments on commit 32dad4d

Please sign in to comment.