Skip to content

Commit

Permalink
fix : 로그인 오류 발견, 파일트리 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
banhogu committed Jun 8, 2024
1 parent 86b7604 commit 5d3c419
Show file tree
Hide file tree
Showing 38 changed files with 47 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/api/auth/auth.post.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const signin = async ({ email, password }: ISignIn) => {
email,
password
});

console.log('실행1');
return response;
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Head from 'next/head';
import { ReactNode } from 'react';
import Footer from '@components/footer/Footer';
import Header from '@/components/header/Header';
import { usePathname } from 'next/navigation';
import deleteFirstWord from '@/utils/deleteFirtstWord';
import ReservationHeader from '../header/ReservationHeader';
import ReservationHeader from './header/ReservationHeader';
import Header from './header/Header';
import Footer from './footer/Footer';

interface LayoutProps {
title?: string;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import MainContainer from '../shared/MainContainer';
import { useRouter } from 'next/router';
import MainContainer from '@/components/shared/MainContainer';

const ChangePasswordDone = () => {
const router = useRouter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { ChangeEvent, Dispatch, useEffect, useRef, useState } from 'react';
import ToBack from '../shared/sign/ToBack';
import { SignupBtnStatus } from '@/models/signupBtnStatus';
import { motion } from 'framer-motion';
import { useMutation } from 'react-query';
import { invertSecond } from '@/utils/invertSecond';
import { emailauthrequest, emailauthverify } from '@/api/auth/auth.post.api';
import { signError } from '@/constant/signError';
import ToBack from '@/components/shared/sign/ToBack';

interface EmailCertificationProps {
setStep: Dispatch<React.SetStateAction<number>>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Dispatch } from 'react';
import ToBack from '../shared/sign/ToBack';
import NewPasswordForm from './NewPasswordForm';
import ToBack from '@/components/shared/sign/ToBack';

const SetNewPassword = ({
setStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@ import React, { useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
import useLogin from '@/hook/useLogin';
import { ISignIn } from '@/api/types/auth';
import { signinmock } from '@/api/mock.api';
// interface SigninType {
// email: string;
// password: string;
// }

const SigninForm = () => {
const [isError, setIsError] = useState(false);
const {
register,
handleSubmit,
// setError,
formState: { errors }
} = useForm<ISignIn>();

useEffect(() => {
signinmock();
}, []);

const { mutate, error } = useLogin();

const FormSubmit = async (data: ISignIn) => {
setIsError(false);
const { email, password } = data;
mutate({ email, password });
//todo : signin 처리
console.log(data);
};

useEffect(() => {
Expand All @@ -41,14 +29,6 @@ const SigninForm = () => {
return () => clearTimeout(timeoutId);
}, [isError]);

// {
// error.length > 2
// ? setError('password', {
// type: 'manual',
// message: '*일치하지 않습니다.'
// })
// : null;
// }
return (
<form
onSubmit={handleSubmit((data) => FormSubmit(data))}
Expand Down Expand Up @@ -106,10 +86,6 @@ const SigninForm = () => {
<input
{...register('password', {
required: true
// pattern: {
// value: /^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{8,16}$/,
// message: '8~16자의 영문 대/소문자, 숫자, 특수문자를 사용해 주세요.'
// }
})}
type="password"
className="outline-none w-full"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
import ToBack from '../shared/sign/ToBack';
import { useMutation } from 'react-query';
import { motion } from 'framer-motion';
import Image from 'next/image';
import { emailauthrequest, emailauthverify } from '../../api/auth/auth.post.api';
import { ApplyValues } from '@/models/applyValues';
import { invertSecond } from '@/utils/invertSecond';
import { SignupBtnStatus } from '@/models/signupBtnStatus';
import { signError } from '@/constant/signError';
import { emailauthrequest, emailauthverify } from '@/api/auth/auth.post.api';
import ToBack from '@/components/shared/sign/ToBack';

/* eslint-disable no-unused-vars */
interface EmailVerification {
onNext: (name: ApplyValues['memberName'], email: ApplyValues['email']) => void;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { SetStateAction, useEffect, useState } from 'react';
import ToBack from '../shared/sign/ToBack';
import Image from 'next/image';
import { ApplyValues } from '@/models/applyValues';
import dynamic from 'next/dynamic';
import Terms from './Terms';
import { JobPositionType } from '@/models/jobPosition';
import { jobPosition } from '@/constant/jobPosition';
import ToBack from '@/components/shared/sign/ToBack';
/* eslint-disable no-unused-vars */
const JobPosition = dynamic(() => import('./JobPosition'), {
ssr: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
import ToBack from '../shared/sign/ToBack';
import { SignupBtnStatus } from '@/models/signupBtnStatus';
import { motion } from 'framer-motion';
import { invertSecond } from '@/utils/invertSecond';
import { useMutation } from 'react-query';
import { phoneauthrequest, phoneauthverify } from '@/api/auth/auth.post.api';
import { ApplyValues } from '@/models/applyValues';
import { signError } from '@/constant/signError';
import ToBack from '@/components/shared/sign/ToBack';

/* eslint-disable no-unused-vars */
interface PhoneCertificationProps {
onNext: (phoneNumber: ApplyValues['memberPhone']) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import MainContainer from '../shared/MainContainer';
import { useRouter } from 'next/router';
import MainContainer from '@/components/shared/MainContainer';

const SignupDone = () => {
const router = useRouter();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions src/hook/useLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { setCookie } from '@/utils/cookies';
import { useRouter } from 'next/navigation';
import { useMutation } from '@tanstack/react-query';
import { useState } from 'react';
import { getTokenHandler } from '@/components/pwa/Fcm';
import { fcmpost } from '@/api/fcm/fcm.post.api';
//todo 기범님 오류
// import { getTokenHandler } from '@/components/pwa/Fcm';
// import { fcmpost } from '@/api/fcm/fcm.post.api';

const useLogin = () => {
const router = useRouter();
Expand All @@ -14,18 +15,17 @@ const useLogin = () => {
const onSuccess = async (data: UserLoginType) => {
const { accessToken } = data.data;
const cookieOptions = { path: '/', maxAge: 600000 * 15 };
const token = await getTokenHandler();
fcmpost({ fcmToken: token });
// const token = await getTokenHandler();
// fcmpost({ fcmToken: token });
setCookie('token', accessToken, cookieOptions);

router.push('/');
console.log(token);
};
const onError = () => {
console.log('error');

const onError = (error: any) => {
setError('*아이디 혹은 비밀번호가 일치하지 않습니다');
console.log(error);
};

const { mutate } = useMutation({
mutationFn: signin,
onSuccess,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { userinfo } from '@/api/auth/auth.get.api';
import Footer from '@/components/footer/Footer';
import MainPageIndex from '@/components/home/MainPageIndex';
import Footer from '@/components/layout/footer/Footer';
import MainContainer from '@/components/shared/MainContainer';
import { useMember, useSetMember } from '@/store/user';
import React, { useEffect } from 'react';
Expand Down
4 changes: 2 additions & 2 deletions src/pages/map/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import MainContainer from '@/components/shared/MainContainer';
import UseMap from '@/components/map/UseMap';
import Footer from '@/components/footer/Footer';
import Footer from '@/components/layout/footer/Footer';

const MapPage = () => {
return (
<MainContainer>
<div className="flex flex-col justify-center items-center gap-[39px] h-screen">
<div className="w-full h-full">
<UseMap />
<Footer/>
<Footer />
</div>
</div>
</MainContainer>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/mypage/changepassword/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from 'react';
import { useForm } from 'react-hook-form';
// import Link from 'next/link';
import { passwordverify } from '@/api/auth/auth.post.api';
import { useMutation } from '@tanstack/react-query';
import { changepassword } from '@/api/auth/auth.patch.api';
import { useRouter } from 'next/navigation';
import { BackArrow } from '@/components/backarrow/BackArrow';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';

export default function PasswordChange() {
const {
register,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/changeprofile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { useState } from 'react';
import Link from 'next/link';
import { useMember } from '@/store/user';
import { getTitleFromDescription, jobPosition } from '@/constant/jobPosition';
import { BackArrow } from '@/components/backarrow/BackArrow';
import { memberimage } from '@/api/auth/auth.patch.api';
import useUpdateMember from '@/hook/useUpdateMember';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';
// import { useQuery } from 'react-query'; // Uncomment when useQuery is available

export default function Profile() {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/guide/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BackArrow } from '@/components/backarrow/BackArrow';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';
import React from 'react';

const GuidePage = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import LogoutModal from '@/components/modal/logoutModal';
import { useState } from 'react';
import useLoggedOut from '@/hook/useLoggedOut';
import SuccessModal from '@/components/modal/successModal';
import Footer from '@/components/footer/Footer';
import useUpdateMember from '@/hook/useUpdateMember';
import Footer from '@/components/layout/footer/Footer';

const MyPage = () => {
const member = useMember();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/notice/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BackArrow } from '@/components/backarrow/BackArrow';
import MainContainer from '@/components/shared/MainContainer';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';
import React, { useState } from 'react';

const NoticePage = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/question/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { questiongetmock, questionpostmock } from '@/api/mock.api';
import { BackArrow } from '@/components/backarrow/BackArrow';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';
import { useQuery } from '@tanstack/react-query';
import React, { useState } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/pages/mypage/withdraw/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { del } from '@/api/auth/auth.delete.api';
import { BackArrow } from '@/components/backarrow/BackArrow';
import MainContainer from '@/components/shared/MainContainer';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';
import { useState } from 'react';

const MemberWithdrawal = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/notification/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { BackArrow } from '@/components/backarrow/BackArrow';
import Footer from '@/components/footer/Footer';
import { Fragment } from 'react';
import useNoticeGet from '@/components/community/hooks/useNoticeGet';
import { NotificationType } from '@/api/types/notification';
Expand All @@ -10,6 +8,8 @@ import {
useNotificationCategory,
useSetNotificationCategory
} from '@/store/notifications.store';
import Footer from '@/components/layout/footer/Footer';
import { BackArrow } from '@/components/sign/backarrow/BackArrow';

const categorizeNotifications = (notifications: NotificationType[]) => {
const today = new Date();
Expand Down
7 changes: 3 additions & 4 deletions src/pages/reservation/[meetingRoomId].tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import MainContainer from '@/components/shared/MainContainer';
import MeetingRoomInfo from '@/components/reservation/meetingRoom/MeetingRoomInfo';
import Footer from '@/components/footer/Footer';
import Footer from '@/components/layout/footer/Footer';

const MeetingRoomDetailPage = () => {

return (
<MainContainer>
<MeetingRoomInfo />
<Footer/>
<MeetingRoomInfo />
<Footer />
</MainContainer>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/pages/reservation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import React from 'react';
const ReservationPage = () => {
return (
<MainContainer>
{/* todo 예약 페이지는 nav바 바꿔야 함. 현재 Layout X */}
<Layout>
<ReservationIndex />
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/reservation/myreservationlist/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client';
import Footer from '@/components/footer/Footer';
import Footer from '@/components/layout/footer/Footer';
import MyReservationListIndex from '@/components/reservation/myReservationList/MyReservationListIndex';
import MainContainer from '@/components/shared/MainContainer';
import React from 'react';
Expand Down
6 changes: 3 additions & 3 deletions src/pages/sign/findpassword/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ChangePasswordDone from '@/components/findpassword/ChangePasswordDone';
import EmailCertification from '@/components/findpassword/EmailCertification';
import SetNewPassword from '@/components/findpassword/SetNewPasswod';
import MainContainer from '@/components/shared/MainContainer';
import ChangePasswordDone from '@/components/sign/findpassword/ChangePasswordDone';
import EmailCertification from '@/components/sign/findpassword/EmailCertification';
import SetNewPassword from '@/components/sign/findpassword/SetNewPasswod';
import React, { useState } from 'react';

const FindPasswordPage = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MainContainer from '@/components/shared/MainContainer';
import SigninForm from '@/components/signin/SigninForm';
import SigninForm from '@/components/sign/signin/SigninForm';

import Link from 'next/link';

Expand Down
14 changes: 4 additions & 10 deletions src/pages/signup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { signup } from '@/api/auth/auth.post.api';
import { ISignUp } from '@/api/types/auth';
import MainContainer from '@/components/shared/MainContainer';
import EmailVerification from '@/components/signup/EmailVerification';
import PasswordVerification from '@/components/signup/PasswordVerification';
import PhoneCertification from '@/components/signup/PhoneCertification';
import SignupDone from '@/components/signup/SignupDone';
import EmailVerification from '@/components/sign/signup/EmailVerification';
import PasswordVerification from '@/components/sign/signup/PasswordVerification';
import PhoneCertification from '@/components/sign/signup/PhoneCertification';
import SignupDone from '@/components/sign/signup/SignupDone';
import { ApplyValues } from '@/models/applyValues';
import { useEffect, useState } from 'react';
import { useMutation } from 'react-query';
Expand Down Expand Up @@ -38,12 +38,6 @@ const SignUpPage = () => {
...prev,
step: (prev.step as number) + 1
}))
// todo : error 처리 필요
// onError: (error: any) => {
// if (error.response.data) {
// setError(true);
// }
// }
}
);

Expand Down

0 comments on commit 5d3c419

Please sign in to comment.