You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
557 B
16 lines
557 B
import { UserEntity } from '../services/types'
|
|
import { LOCAL_STORAGE_KEY } from './constants'
|
|
|
|
export const saveUserAndToken = (user: UserEntity, accessToken: string) => {
|
|
if (typeof localStorage !== 'undefined') {
|
|
localStorage.setItem(LOCAL_STORAGE_KEY.USER, JSON.stringify(user))
|
|
localStorage.setItem(LOCAL_STORAGE_KEY.TOKEN, accessToken)
|
|
}
|
|
}
|
|
|
|
export const removeUserAndToken = () => {
|
|
if (typeof localStorage !== 'undefined') {
|
|
localStorage.removeItem(LOCAL_STORAGE_KEY.USER)
|
|
localStorage.removeItem(LOCAL_STORAGE_KEY.TOKEN)
|
|
}
|
|
}
|