We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e1b3931 commit bc68e0bCopy full SHA for bc68e0b
hocs/withAuth.js
@@ -1,11 +1,12 @@
1
import { useRouter } from 'next/router'
2
-// import get from 'lodash/get'
+import get from 'lodash/get'
3
4
-const withAuth = (WrappedComponent, { loginRequired = true }) => {
+const withAuth = (WrappedComponent, props) => {
5
return (props) => {
6
// checks whether we are on client / browser or server.
7
if (typeof window !== 'undefined') {
8
const Router = useRouter()
9
+ const loginRequired = get(props, 'loginRequired', true)
10
11
const accessToken = localStorage.getItem('feathers-jwt')
12
0 commit comments