feat: protect client pages

This commit is contained in:
Riccardo
2024-07-07 23:33:07 +02:00
parent 4151e96876
commit be05e065b8
2 changed files with 6 additions and 4 deletions

View File

@@ -1,10 +1,11 @@
'use client';
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
import { CustomerForm, CustomerFormSchema } from '@utils/types';
import axios from 'axios';
import { useEffect, useState } from 'react';
export default function SingleCustomerForm({
export default withPageAuthRequired(function SingleCustomerForm({
params
}: {
params: { id: string };
@@ -39,4 +40,4 @@ export default function SingleCustomerForm({
Form {params.id} {JSON.stringify(customerForm)}
</div>
);
}
});

View File

@@ -1,5 +1,6 @@
'use client';
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
import { Button } from '@components/Button';
import { FormControl } from '@components/FormControl';
import { FormMessage } from '@components/FormMessage';
@@ -20,7 +21,7 @@ import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
export default function CustomerForms() {
export default withPageAuthRequired(function CustomerForms() {
const router = useRouter();
const [customerForms, setCustomerForms] = useState<CustomerForm[]>([]);
@@ -116,4 +117,4 @@ export default function CustomerForms() {
</FormProvider>
</>
);
}
});