Skip to content

Commit

Permalink
feat(mm-registration): use sessionstorage instead of localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricmagne committed Oct 2, 2024
1 parent 643b82c commit ebb1af3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/AuthLogin/AuthModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const AuthModal = ({ open, setOpen, step, setStep }: AuthModalProps) => {
const mm_auth = Buffer.from(
JSON.stringify({
step: data.step,
mmAuthSession: localStorage.getItem(AUTH_WALLET_SESSION_NAME),
mmAuthSession: sessionStorage.getItem(AUTH_WALLET_SESSION_NAME),
walletPairing: data.pairing,
token: true,
})
Expand Down
10 changes: 5 additions & 5 deletions src/lib/siwsrp/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ const getHydraEnv = (env: string): HydraEnv => {

const storage: SDK.AuthStorageOptions = {
getLoginResponse: async () => {
const storedResponse = localStorage.getItem(AUTH_WALLET_SESSION_NAME);
const storedResponse = sessionStorage.getItem(AUTH_WALLET_SESSION_NAME);
return storedResponse ? JSON.parse(storedResponse) : null;
},
setLoginResponse: async (val: SDK.LoginResponse) => {
localStorage.setItem(AUTH_WALLET_SESSION_NAME, JSON.stringify(val));
sessionStorage.setItem(AUTH_WALLET_SESSION_NAME, JSON.stringify(val));
},
};

Expand Down Expand Up @@ -85,7 +85,7 @@ export const getUserIdFromJwtToken = () => {

export const clearStorage = () => {
sessionStorage.clear();
localStorage.removeItem(AUTH_WALLET_SESSION_NAME);
localStorage.removeItem(AUTH_WALLET_TOKEN);
localStorage.removeItem(AUTH_WALLET_PROJECTS);
sessionStorage.removeItem(AUTH_WALLET_SESSION_NAME);
sessionStorage.removeItem(AUTH_WALLET_TOKEN);
sessionStorage.removeItem(AUTH_WALLET_PROJECTS);
};

0 comments on commit ebb1af3

Please sign in to comment.