-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from themoment-team/develop
Develop
- Loading branch information
Showing
19 changed files
with
262 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pallete from 'shared/Pallete'; | ||
|
||
export const RightArrow: React.FC<React.SVGProps<SVGSVGElement>> = props => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={18} | ||
height={13} | ||
viewBox="0 0 320 512" | ||
fill={pallete.scheme.blue} | ||
{...props} | ||
> | ||
<path d="M96 480c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L242.8 256L73.38 86.63c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l192 192c12.5 12.5 12.5 32.75 0 45.25l-192 192C112.4 476.9 104.2 480 96 480z" /> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { | |
useEffect, | ||
useState, | ||
} from 'react'; | ||
import { AxiosError, AxiosResponse } from 'axios'; | ||
import { css } from '@emotion/react'; | ||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||
import toast from 'react-hot-toast'; | ||
|
@@ -60,14 +61,24 @@ export const CompanyFormComponent: React.FC<CompanyFormProps> = ({ | |
|
||
axiosClient | ||
.post(companyUrl.getAllCompany(), reqData) | ||
.then(function (response) { | ||
.then(function (response: AxiosResponse) { | ||
toast.success('회사 등록이 완료되었어요'); | ||
setCompanyFormModalVisible(false); | ||
mutate(companyUrl.getAllCompany()); | ||
}) | ||
.catch(function (error) { | ||
.catch(function (error: AxiosError<{ message: string }>) { | ||
console.log(error); | ||
toast.error('회사 등록에 실패했어요'); | ||
if (error.response) { | ||
switch (error.response.status) { | ||
case 400: | ||
toast.error(error.response.data.message); | ||
break; | ||
default: | ||
toast.error( | ||
'알 수 없는 이유로 등록에 실패했어요\[email protected]에 문의해주세요', | ||
); | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
|
@@ -91,7 +102,7 @@ export const CompanyFormComponent: React.FC<CompanyFormProps> = ({ | |
<S.Input | ||
{...register('companyImgUri')} | ||
required | ||
placeholder="회사 이미지 url" | ||
placeholder="회사 이미지 링크" | ||
type="url" | ||
onChange={(e: ChangeEvent<HTMLInputElement>) => { | ||
setPreviewCompanyImgUri(e.target.value); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'; | ||
import { AxiosError, AxiosResponse } from 'axios'; | ||
import { Dispatch, SetStateAction, useState } from 'react'; | ||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||
import { useSWRConfig } from 'swr'; | ||
import toast from 'react-hot-toast'; | ||
import { css } from '@emotion/react'; | ||
import { useRouter } from 'next/router'; | ||
|
||
import { Modal } from 'components/common/Modal'; | ||
import { CompanyForm } from 'components/CompanyForm'; | ||
import { WorkerReqData } from 'types/worker.type'; | ||
import axiosClient from 'libs/axios/axiosClient'; | ||
import { workerUrl } from 'libs/api/apiUrlControllers'; | ||
import useCompanyList from 'hooks/api/company/use-company-list'; | ||
|
||
import * as S from './Form.styles'; | ||
|
@@ -25,15 +23,8 @@ export const FormComponent: React.FC<SignUpFormProps> = ({ | |
const { register, handleSubmit } = useForm<InputListType>(); | ||
const [companyFormModalVisible, setCompanyFormModalVisible] = | ||
useState<boolean>(false); | ||
const { mutate } = useSWRConfig(); | ||
const router = useRouter(); | ||
const { data } = useCompanyList(); | ||
|
||
useEffect(() => { | ||
router.replace(router.pathname); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
|
||
const onSubmit: SubmitHandler<InputListType> = async data => { | ||
// TODO: post 로직 고도화 | ||
const reqData: WorkerReqData = { | ||
|
@@ -49,21 +40,38 @@ export const FormComponent: React.FC<SignUpFormProps> = ({ | |
|
||
axiosClient | ||
.post('/auth/registration', reqData) | ||
.then(function (response) { | ||
.then(function (response: AxiosResponse) { | ||
toast.success('회원가입이 완료되었어요'); | ||
mutate(workerUrl.getAllWorker()); | ||
setSignUpFormVisible(false); | ||
window.location.reload(); | ||
}) | ||
.catch(function (error) { | ||
.catch(function (error: AxiosError<{ message: string }>) { | ||
console.log(error); | ||
toast.error('회원가입에 실패했어요'); | ||
if (error.response) { | ||
switch (error.response.status) { | ||
case 400: | ||
toast.error(error.response.data.message); | ||
break; | ||
case 401: | ||
toast.error( | ||
'로그인 정보가 없어요\n새로고침 후 다시 한번 로그인 해주세요', | ||
); | ||
break; | ||
case 403: | ||
toast.error('이미 프로필이 등록되어있어요'); | ||
break; | ||
default: | ||
toast.error( | ||
'알 수 없는 이유로 등록에 실패했어요\[email protected]에 문의해주세요', | ||
); | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
return ( | ||
<S.FormWrapper> | ||
<S.Form onSubmit={handleSubmit(onSubmit)}> | ||
<S.FormHeader>회원가입</S.FormHeader> | ||
<S.FormHeader>프로필 등록하기</S.FormHeader> | ||
<S.Input {...register('name')} placeholder="이름" required /> | ||
<S.Input | ||
{...register('email')} | ||
|
@@ -127,7 +135,15 @@ export const FormComponent: React.FC<SignUpFormProps> = ({ | |
required | ||
maxLength={100} | ||
/> | ||
<S.Submit type="submit" value={'완료'} /> | ||
<S.ButtonWrapper> | ||
<S.CancelButton | ||
onClick={() => setSignUpFormVisible(false)} | ||
type="button" | ||
> | ||
취소 | ||
</S.CancelButton> | ||
<S.Submit type="submit" value={'완료'} /> | ||
</S.ButtonWrapper> | ||
</S.Form> | ||
{companyFormModalVisible && ( | ||
<Modal setModalVisible={setCompanyFormModalVisible}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2e534f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hi-recruit-front – ./
hi-recruit-front-hi-recruit.vercel.app
hi-recruit-front-git-master-hi-recruit.vercel.app
www.hirecruit.site
hirecruit.site