'init'
This commit is contained in:
14
app/hooks/useAuth.ts
Normal file
14
app/hooks/useAuth.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
function useAuth() {
|
||||
const [isAuthenticated, setIsAuthenticated] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
const authStatus = localStorage.getItem('auth_key');
|
||||
setIsAuthenticated(authStatus !== '');
|
||||
}, []);
|
||||
|
||||
return isAuthenticated;
|
||||
}
|
||||
|
||||
export default useAuth;
|
||||
Reference in New Issue
Block a user