mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-10-29 19:13:36 +00:00
Fixed authentication redirect upon signin using states
Finally fixed dashboard defaults for new user signups
This commit is contained in:
@@ -255,6 +255,13 @@ export const AuthProvider = ({ children }) => {
|
||||
}
|
||||
}, [token, user, checkAdminUsersExist])
|
||||
|
||||
const setAuthState = (authToken, authUser) => {
|
||||
setToken(authToken)
|
||||
setUser(authUser)
|
||||
localStorage.setItem('token', authToken)
|
||||
localStorage.setItem('user', JSON.stringify(authUser))
|
||||
}
|
||||
|
||||
const value = {
|
||||
user,
|
||||
token,
|
||||
@@ -267,6 +274,7 @@ export const AuthProvider = ({ children }) => {
|
||||
updateProfile,
|
||||
changePassword,
|
||||
refreshPermissions,
|
||||
setAuthState,
|
||||
isAuthenticated,
|
||||
isAdmin,
|
||||
hasPermission,
|
||||
|
||||
Reference in New Issue
Block a user