Skip to content

Commit

Permalink
Use try/finally syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc authored and marcus-oscarsson committed Nov 25, 2024
1 parent 2d6aed6 commit a0d81fc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ui/src/actions/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@ export function ssoLogIn() {

export function signOut() {
return async (dispatch) => {
dispatch(resetLoginInfo()); // disconnect sockets before actually logging out (cf. `App.jsx`)
dispatch(applicationFetched(false));
// We make sure that user data is reseted so that websockets
// are keept dicconnected while logging out.
dispatch(resetLoginInfo());
await sendSignOut().finally(() =>
dispatch(
// Retreiving the user data from the backend
getLoginInfo(),
),
);

try {
await sendSignOut();
} finally {
dispatch(getLoginInfo());
}
};
}

Expand Down

0 comments on commit a0d81fc

Please sign in to comment.