Skip to main content

Posts

Showing posts with the label permission

check permission for admin on navbar instead of withSession(App) - on every component

AdminNavbarLinks.js: if ( profile && profile . admin !== true && window . location . href . indexOf ( '/admin' ) !== - 1 ) { router . push ( '/login' ) } const withSession = Component => props => ( < Query query = { GET_ME } > { ({ data , loading , refetch }) => ( < Component { ... props } loading = { loading } session = { data } refetch = { refetch } /> ) } </ Query > ) export default withSession