From c9365c56ad9a24b31518f5642f7079acd4a3c72a Mon Sep 17 00:00:00 2001 From: KenNoYu Date: Thu, 1 Aug 2024 18:51:51 +0800 Subject: [PATCH] fix: fix format error --- client/src/pages/route-map.tsx | 2 +- client/src/pages/user/accountsettings.tsx | 48 ++++++++++++----------- client/src/pages/user/homepage.tsx | 2 +- server/src/v1/route-map.ts | 3 +- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/client/src/pages/route-map.tsx b/client/src/pages/route-map.tsx index aa3ec669..fa825db2 100644 --- a/client/src/pages/route-map.tsx +++ b/client/src/pages/route-map.tsx @@ -43,6 +43,6 @@ const routes: RootRouteMap = { }, ...authRouteMap, ...userRouteMap, - ...foodRouteMap + ...foodRouteMap, } as const; export default routes; diff --git a/client/src/pages/user/accountsettings.tsx b/client/src/pages/user/accountsettings.tsx index 7ad9c36b..91818006 100644 --- a/client/src/pages/user/accountsettings.tsx +++ b/client/src/pages/user/accountsettings.tsx @@ -9,7 +9,7 @@ import * as z from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm, useFormState } from 'react-hook-form'; -import httpClient, { APIPayload } from '@utils/http'; +import httpClient from '@utils/http'; import { AuthContext } from '@service/auth'; import { userUpdateSchema } from '@lib/api-types/schemas/user'; import type { UpdateUserSuccAPI } from '@lib/api-types/user'; @@ -31,8 +31,9 @@ import { Input } from '@components/ui/input'; import { Button } from '@components/ui/button'; import { PageComponent } from '@pages/route-map'; import { useNavigate } from 'react-router-dom'; +import { cn } from '@utils/tailwind'; -const AccountSettings: PageComponent = () => { +const AccountSettings: PageComponent = ({ className, ...props }) => { const { user } = useContext(AuthContext)!; const [error, setError] = useState(null); const [successMessage, setSuccessMessage] = useState(null); @@ -40,7 +41,6 @@ const AccountSettings: PageComponent = () => { const { toast } = useToast(); const navigate = useNavigate(); - const accountSettingsForm = useForm>({ resolver: zodResolver(userUpdateSchema), defaultValues: { @@ -77,11 +77,11 @@ const AccountSettings: PageComponent = () => { { mutationKey: ['delete-user'], mutationFn: () => { - return httpClient.delete, APIPayload>({ - uri: '/user/deleteUser', + return httpClient.delete>({ + uri: '/user', withCredentials: 'access', }); - }, + }, onError: (err) => { console.log(err); toast({ @@ -100,11 +100,16 @@ const AccountSettings: PageComponent = () => { ); return ( -
-
+
+

My Account

-
-

Personal Particulars

+
+

+ Personal Particulars +

{ )} /> -
+
-
- -
+
+ +
); diff --git a/client/src/pages/user/homepage.tsx b/client/src/pages/user/homepage.tsx index b76f8637..178f2a59 100644 --- a/client/src/pages/user/homepage.tsx +++ b/client/src/pages/user/homepage.tsx @@ -49,6 +49,6 @@ const Home: PageComponent = (props) => {
); -} +}; export default Home; diff --git a/server/src/v1/route-map.ts b/server/src/v1/route-map.ts index 9d35c274..cbf900f5 100644 --- a/server/src/v1/route-map.ts +++ b/server/src/v1/route-map.ts @@ -18,10 +18,11 @@ const routeMap: RoutingMap<`/v1/${string}`> = { GET: { handler: getUser, accessLevel: 'authenticated', + authOptions: { allowNonActivated: true }, }, DELETE: { handler: deleteUser, - accessLevel: 'authenticated' + accessLevel: 'authenticated', }, }, '/v1/user/update': {