Skip to content

Commit

Permalink
FE-34 ✨ 프로필 수정 완료 시 toast 메세지 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
전유민 committed Jul 16, 2024
1 parent 6109567 commit 7457dd6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import '@/styles/globals.css';
import type { AppProps } from 'next/app';
import { HydrationBoundary, QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import Toaster from '@/components/ui/toaster';

export default function App({ Component, pageProps }: AppProps) {
const [queryClient] = React.useState(() => new QueryClient());
return (
<QueryClientProvider client={queryClient}>
<HydrationBoundary state={pageProps.dehydratedState}>
<Component {...pageProps} />
<Toaster />
</HydrationBoundary>
<ReactQueryDevtools />
</QueryClientProvider>
Expand Down
6 changes: 6 additions & 0 deletions src/user/ui-profile/ProfileEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Form, Formik, useFormik } from 'formik';
import { useCreatePresignedUrl, useUpdateMe } from '@/hooks/userQueryHooks';
import * as Yup from 'yup';
import fileNameChange from '../util/fileNameChange';
import { useToast } from '@/components/ui/use-toast';

interface UserProfileEditProps {
initialValues: {
Expand All @@ -26,13 +27,18 @@ export default function ProfileEdit({ initialValues, onModalClose }: UserProfile
const createPresignedUrl = useCreatePresignedUrl();
const fileInputRef = useRef<HTMLInputElement | null>(null);

const { toast } = useToast();

const handleSubmit = async () => {
await formik.submitForm(); // Formik의 submitForm 함수 호출
};

const { mutate: updateMe } = useUpdateMe({
onSuccess: () => {
onModalClose();
toast({
description: '프로필 수정이 완료되었습니다.',
});
},
});

Expand Down

0 comments on commit 7457dd6

Please sign in to comment.