How do i integrate user role permissions using react and nodejs

Viewed 26

i am new to react and nodejs and i want to create a role based authentication just so the admin gets access to some views that a random user won't have access to. I have succeeded in restricting the views specified for the admin only but please how to i then integrate the nodejs so that when i create a user i want to be the admin everything follows suit.

import {createContext, useState} from "react";

const AuthContext = createContext({})


export const AuthProvider = ({children}) => {
    const [auth, setAuth] = useState({})
    return(
        <AuthContext.Provider value={{auth, setAuth}}>
            {children}
        </AuthContext.Provider>
    )
}


export default AuthContext;

0 Answers
Related