diff --git a/packages/app/package.json b/packages/app/package.json index 40e61a79..243fec55 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -12,6 +12,7 @@ "dependencies": { "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", + "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^3.4.2", "@reduxjs/toolkit": "^1.9.3", "@sms/shared": "workspace:*", diff --git a/packages/app/src/features/global/Header/index.tsx b/packages/app/src/features/global/Header/index.tsx index 670f458b..82166d8a 100644 --- a/packages/app/src/features/global/Header/index.tsx +++ b/packages/app/src/features/global/Header/index.tsx @@ -6,7 +6,8 @@ import useLogout from '@features/auth/hook/useLogout' import useMyPage from '@features/student/hooks/useMyPage' import useProfileImgQuery from '@features/auth/queries/useProfileImgQuery' import useLoggedInQuery from '@features/auth/queries/useLoggedInQuery' -// import useGSMInfo from '@features/student/hooks/useGSMInfo' +import useAuthenticationRedirect from '@features/student/hooks/useAuthenticationRedirect' +import Role from 'types/Role' import * as S from './style' @@ -18,7 +19,7 @@ interface Props { const Header = ({ onFilter }: Props) => { const { onLogout } = useLogout() const { redirectMyPage } = useMyPage() - // const { redirectGSMInfo } = useGSMInfo() + const { redirectAuthentication } = useAuthenticationRedirect() const [isShow, setIsShow] = useState(false) const { data: loggedInData } = useLoggedInQuery() const { data } = useProfileImgQuery() @@ -59,16 +60,22 @@ const Header = ({ onFilter }: Props) => { setIsShow(false)}> - {/* - 인증제 - */} - 마이페이지 + {loggedInData.role === Role.ROLE_STUDENT && ( + <> + + 인증제 + + + + + )} + 로그아웃 diff --git a/packages/app/src/features/register/molecules/AuthenticationInputs/index.tsx b/packages/app/src/features/register/molecules/AuthenticationInputs/index.tsx deleted file mode 100644 index e57a05a2..00000000 --- a/packages/app/src/features/register/molecules/AuthenticationInputs/index.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import HideAbleWrapper from '@features/register/atoms/HideAbleWrapper' -import { InputColumn } from '@features/register/atoms' -import { ImageInput, Input, Textarea } from '@sms/shared' -import { RegisterFormType } from '@features/register/type' -import * as Icon from '@sms/shared/src/icons' -import { - Control, - FieldErrors, - UseFormGetValues, - UseFormRegister, - UseFormSetError, - UseFormSetValue, - useFieldArray, - UseFormClearErrors, -} from 'react-hook-form' -import { useState } from 'react' -import useImageUpload from '@features/register/hooks/useImageUpload' -import * as S from './style' - -interface Props { - idx: number - control: Control - register: UseFormRegister - errors: FieldErrors - setValue: UseFormSetValue - watch: UseFormGetValues - setError: UseFormSetError - clearErrors: UseFormClearErrors -} - -const AuthenticationInput = ({ - idx, - control, - register, - errors, - setValue, - watch, - setError, - clearErrors, -}: Props) => { - const { fields, remove, append } = useFieldArray({ - name: 'activities', - control, - }) - - const { onChange } = useImageUpload({ - setValue: (value: string) => { - setValue(`activities.${idx}.previewImage`, [value]) - setMinLength(200) - }, - setError: (message) => { - setError(`activities.${idx}.previewImage`, { message }) - setMinLength(400) - }, - clearError: () => { - clearErrors(`activities.${idx}.previewImage`) - setMinLength(400) - }, - }) - - const onClick = () => - append({ - name: '', - myActivity: '', - description: '', - previewImage: [], - }) - - const [minLength, setMinLength] = useState(400) - - return ( - - - {fields.map((field, idx) => ( -
- remove(idx)} - > - - - - - - - - - - - -