Skip to content

Commit 40aed0a

Browse files
committed
Clear saving state when logout is called without a user
1 parent c5c1ed4 commit 40aed0a

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/state/store.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,21 @@ store.signup = action(function signup(name, email, password) {
125125

126126
store.logout = action(function logout() {
127127
store.startAction();
128-
return (
129-
store.user &&
130-
store.user
131-
.logout()
132-
.then(
133-
action(() => {
134-
store.user = null;
135-
store.modal.page = "login";
136-
store.saving = false;
137-
})
138-
)
139-
.catch(store.setError)
140-
);
128+
return store.user
129+
? store.user
130+
.logout()
131+
.then(
132+
action(() => {
133+
store.user = null;
134+
store.modal.page = "login";
135+
store.saving = false;
136+
})
137+
)
138+
.catch(store.setError)
139+
: action(() => {
140+
store.modal.page = "login";
141+
store.saving = false;
142+
});
141143
});
142144

143145
store.updatePassword = action(function updatePassword(password) {

0 commit comments

Comments
 (0)