Private
Public Access
primer draft de la pagina
This commit is contained in:
1 parent
02a6c846dc
commit
fcc3952841
42 files changed
+1248
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import type { User } from '../../types';
|
||||
|
||||
export function getCurrentUser(): User | null {
|
||||
if (typeof window !== 'undefined') {
|
||||
const user = localStorage.getItem('user');
|
||||
if (user == 'undefined') return null;
|
||||
return user ? JSON.parse(user) : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function setCurrentUser(user: User): void {
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem('user', JSON.stringify(user));
|
||||
}
|
||||
}
|
||||
|
||||
export function removeCurrentUser(): void {
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.removeItem('user');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user