Skip to content

Commit 8e472f1

Browse files
committed
Add try-catch to localStorage functions
1 parent 0f8afe2 commit 8e472f1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/local-storage.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ export const loadAuthToken = () => {
33
};
44

55
export const saveAuthToken = authToken => {
6-
localStorage.setItem('authToken', authToken);
6+
try {
7+
localStorage.setItem('authToken', authToken);
8+
} catch (e) {}
79
};
810

911
export const clearAuthToken = () => {
10-
localStorage.removeItem('authToken');
12+
try {
13+
localStorage.removeItem('authToken');
14+
} catch (e) {}
1115
};

0 commit comments

Comments
 (0)