Skip to content

Commit

Permalink
fix: add setCurrentUser function. allow for logout. remove unused set…
Browse files Browse the repository at this point in the history
…User function. (#157)
  • Loading branch information
paulschreiber authored Nov 6, 2023
1 parent 41efed4 commit a6316be
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/account/accountSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ export const userSlice = createSlice({
initialState,

reducers: {
setUser: (state, action) => ({
setCurrentUser: (state, action) => ({
...state,
user: action.payload,
currentUser: {
data: action.payload,
fetching: false,
},
}),
setHasToken: (state, action) => ({
...state,
Expand Down Expand Up @@ -270,7 +273,7 @@ export const userSlice = createSlice({
},
});

export const { setUser, setUsers, updateUsers, setHasToken, addUser } =
export const { setCurrentUser, setUsers, updateUsers, setHasToken, addUser } =
userSlice.actions;

export default userSlice.reducer;
Expand All @@ -281,4 +284,5 @@ export const signOut = () => (dispatch: SharedDispatch) => {
});
removeToken();
dispatch(setHasToken(false));
dispatch(setCurrentUser(null));
};

0 comments on commit a6316be

Please sign in to comment.