Skip to content

Commit 7bd9b59

Browse files
committed
fix: remove localStorage item
1 parent 3555182 commit 7bd9b59

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/hooks/authState.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
import { atom } from 'recoil';
22

3-
const localStorageEffect =
4-
key =>
5-
({ setSelf, onSet }) => {
6-
const savedValue = localStorage.getItem(key);
7-
if (savedValue != null) setSelf(JSON.parse(savedValue));
8-
9-
onSet(newValue => {
10-
if (newValue) localStorage.setItem(key, JSON.stringify(newValue));
11-
else localStorage.removeItem(key);
12-
});
13-
};
14-
153
export const authState = atom({
164
key: 'authState',
175
default: {
186
isAuthenticated: false,
197
},
20-
effects: [localStorageEffect('authState')],
8+
effects: [],
219
});

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import reportWebVitals from './reportWebVitals';
1515
import Router from './router';
1616
import { DomainProvider } from './contexts/DomainContext';
1717

18+
localStorage.removeItem('authState');
19+
localStorage.removeItem('refreshToken');
20+
localStorage.removeItem('accessToken');
21+
1822
export const queryClient = new QueryClient();
1923

2024
const root = ReactDOM.createRoot(document.getElementById('root'));

0 commit comments

Comments
 (0)