1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

added session for auth

This commit is contained in:
Fedor Katurov 2022-01-21 17:56:17 +07:00
parent bb785ea459
commit 27763be864
3 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,18 @@
import { useEffect } from 'react';
import { autorun } from 'mobx';
import { useAuthStore } from '~/store/auth/useAuthStore';
import { setCookie } from '~/utils/dom/cookie';
export const useSessionCookie = () => {
const auth = useAuthStore();
useEffect(
() =>
autorun(() => {
setCookie('session', auth.token, 30);
}),
[auth]
);
};