Fix Authentication
This commit is contained in:
@@ -87,7 +87,8 @@ function AuthProvider({ children }: AuthProviderProps) {
|
||||
console.log('initialize', state)
|
||||
try {
|
||||
const accessToken = getSession();
|
||||
|
||||
|
||||
console.log('')
|
||||
if (accessToken) {
|
||||
setSession(accessToken);
|
||||
|
||||
@@ -111,7 +112,6 @@ function AuthProvider({ children }: AuthProviderProps) {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
dispatch({
|
||||
type: Types.Initial,
|
||||
payload: {
|
||||
@@ -124,7 +124,6 @@ function AuthProvider({ children }: AuthProviderProps) {
|
||||
|
||||
initialize();
|
||||
}, []);
|
||||
// const csrf = () => axios.get('/sanctum/csrf-cookie')
|
||||
|
||||
const login = async (email: string, password: string) => {
|
||||
return axios
|
||||
@@ -169,8 +168,7 @@ function AuthProvider({ children }: AuthProviderProps) {
|
||||
dispatch({ type: Types.Logout });
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthContext.Provider
|
||||
return (<AuthContext.Provider
|
||||
value={{
|
||||
...state,
|
||||
method: 'jwt',
|
||||
|
||||
Reference in New Issue
Block a user