Skip to content

Commit

Permalink
Refactor setTokens function in profileState.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mansithaeashwara committed Jan 25, 2024
1 parent 4d80fb5 commit 23c7c8c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions code/client/impax/src/states/profileState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ export const useLoginState = create<LoginState>()((set) => ({
loginInfo: {teamId: "", teamName: "", email: ""},
setLoginInfo: (loginInfo) => set({ loginInfo: loginInfo}),
tokens: {accessToken: "", refreshToken: ""},
setTokens: (tokens) => set((prevState)=>{ prevState.tokens = tokens;
localStorage.setItem('accessToken', tokens.accessToken);
localStorage.setItem('refreshToken', tokens.refreshToken);
return prevState;})
setTokens: (tokens) => {set({tokens: tokens});
localStorage.setItem("accessToken", tokens.accessToken);
localStorage.setItem("refreshToken", tokens.refreshToken);}

,

Expand Down

0 comments on commit 23c7c8c

Please sign in to comment.