feat: protect client pages
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
|
||||||
import { CustomerForm, CustomerFormSchema } from '@utils/types';
|
import { CustomerForm, CustomerFormSchema } from '@utils/types';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export default function SingleCustomerForm({
|
export default withPageAuthRequired(function SingleCustomerForm({
|
||||||
params
|
params
|
||||||
}: {
|
}: {
|
||||||
params: { id: string };
|
params: { id: string };
|
||||||
@@ -39,4 +40,4 @@ export default function SingleCustomerForm({
|
|||||||
Form {params.id} {JSON.stringify(customerForm)}
|
Form {params.id} {JSON.stringify(customerForm)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
|
||||||
import { Button } from '@components/Button';
|
import { Button } from '@components/Button';
|
||||||
import { FormControl } from '@components/FormControl';
|
import { FormControl } from '@components/FormControl';
|
||||||
import { FormMessage } from '@components/FormMessage';
|
import { FormMessage } from '@components/FormMessage';
|
||||||
@@ -20,7 +21,7 @@ import { useRouter } from 'next/navigation';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { FormProvider, useForm } from 'react-hook-form';
|
import { FormProvider, useForm } from 'react-hook-form';
|
||||||
|
|
||||||
export default function CustomerForms() {
|
export default withPageAuthRequired(function CustomerForms() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [customerForms, setCustomerForms] = useState<CustomerForm[]>([]);
|
const [customerForms, setCustomerForms] = useState<CustomerForm[]>([]);
|
||||||
|
|
||||||
@@ -116,4 +117,4 @@ export default function CustomerForms() {
|
|||||||
</FormProvider>
|
</FormProvider>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user