-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: navigate 정상화 * fix: 모집 차수 깨져 보이는 현상 개선 * fix: 모집 기간 아닐 때 에러 화면 제거 * fix: signup화면 제출 문구 수정 * refac: 이메일 도메인 직접 입력할 수 있도록 변경 * feat: 로그아웃 로직 붙임 * fix: wowds-ui 버전 업데이트
- Loading branch information
Showing
17 changed files
with
269 additions
and
158 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
import apiClient from '..'; | ||
|
||
const authApi = { | ||
LOGOUT: async () => { | ||
const response = await apiClient.get(`/auth/logout`); | ||
return response.data; | ||
} | ||
}; | ||
export default authApi; |
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
File renamed without changes.
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,139 @@ | ||
import { useState } from 'react'; | ||
import styled from '@emotion/styled'; | ||
import { Control, Controller } from 'react-hook-form'; | ||
import DropDown from 'wowds-ui/DropDown'; | ||
import DropDownOption from 'wowds-ui/DropDownOption'; | ||
import { space } from 'wowds-tokens'; | ||
import TextField from 'wowds-ui/TextField'; | ||
|
||
type DepartmentSelectProps = { | ||
control: | ||
| Control<{ | ||
name: string; | ||
studentId: string; | ||
phone: string; | ||
department: string; | ||
email: string; | ||
emailDomain: string; | ||
terms: boolean; | ||
personalPrivacy: boolean; | ||
}> | ||
| undefined; | ||
}; | ||
|
||
const EmailInputField = ({ control }: DepartmentSelectProps) => { | ||
const [customEmail, setCustomEmail] = useState(false); | ||
return ( | ||
<EmailFieldWrapper> | ||
<Controller | ||
name="email" | ||
control={control} | ||
defaultValue="" | ||
rules={{ | ||
required: { | ||
value: true, | ||
message: '* 정보를 입력해주세요.' | ||
} | ||
}} | ||
render={({ field, fieldState }) => ( | ||
<TextFieldWrapper> | ||
<TextField | ||
style={{ minWidth: '100%' }} | ||
label="이메일" | ||
error={fieldState.invalid} | ||
ref={field.ref} | ||
onChange={field.onChange} | ||
onBlur={field.onBlur} | ||
placeholder="내용을 입력하세요" | ||
helperText={fieldState.error ? fieldState.error?.message : ''} | ||
/> | ||
</TextFieldWrapper> | ||
)} | ||
/> | ||
<Controller | ||
name="emailDomain" | ||
control={control} | ||
defaultValue="" | ||
rules={{ | ||
required: { | ||
value: true, | ||
message: '* 도메인을 입력해주세요.' | ||
}, | ||
pattern: { | ||
value: /^@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/, | ||
message: '* 이메일 도메인 형식을 지켜주세요.' | ||
} | ||
}} | ||
render={({ field, fieldState }) => ( | ||
<TextFieldWrapper> | ||
{customEmail ? ( | ||
<TextFieldWrapper> | ||
<TextField | ||
style={{ minWidth: '100%' }} | ||
label="도메인" | ||
error={fieldState.invalid} | ||
ref={field.ref} | ||
onChange={field.onChange} | ||
onBlur={field.onBlur} | ||
value={field.value} | ||
placeholder="내용을 입력하세요" | ||
helperText={fieldState.error ? fieldState.error?.message : ''} | ||
/> | ||
</TextFieldWrapper> | ||
) : ( | ||
<DropDown | ||
placeholder="선택하세요" | ||
{...field} | ||
onChange={({ selectedValue }) => { | ||
if (selectedValue === 'custom') { | ||
setCustomEmail(true); | ||
} else { | ||
field.onChange(selectedValue); | ||
} | ||
}} | ||
style={{ marginTop: '22px', flex: 1, width: '100%' }}> | ||
<DropDownOption | ||
key="gmail" | ||
text="@gmail.com" | ||
value="@gmail.com" | ||
/> | ||
<DropDownOption | ||
key="naver" | ||
text="@naver.com" | ||
value="@naver.com" | ||
/> | ||
<DropDownOption | ||
key="hongik" | ||
text="@g.hongik.ac.kr" | ||
value="@g.hongik.ac.kr" | ||
/> | ||
<DropDownOption key="daum" text="@daum.net" value="@daum.net" /> | ||
<DropDownOption | ||
key="custom" | ||
text="직접 입력하기" | ||
value="custom" | ||
/> | ||
</DropDown> | ||
)} | ||
</TextFieldWrapper> | ||
)} | ||
/> | ||
</EmailFieldWrapper> | ||
); | ||
}; | ||
|
||
export default EmailInputField; | ||
|
||
const TextFieldWrapper = styled.div` | ||
flex: 1; | ||
height: 84.8px; | ||
`; | ||
|
||
const EmailFieldWrapper = styled.div` | ||
position: relative; | ||
width: 100%; | ||
display: flex; | ||
gap: ${space.sm}; | ||
align-items: center; | ||
justify-content: space-between; | ||
`; |
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,2 +1,3 @@ | ||
export { default as useSendStudentEmail } from './useSendStudentEmail'; | ||
export { default as useVerifyStudentEmail } from './useVerifyStudentEmail'; | ||
export { default as useLogout } from './useLogout'; |
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,23 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import authApi from '@/apis/auth/authApi'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import RoutePath from '@/routes/routePath'; | ||
import { toast } from 'react-toastify'; | ||
|
||
export default function useLogout() { | ||
const navigate = useNavigate(); | ||
|
||
const mutation = useMutation({ | ||
mutationFn: authApi.LOGOUT, | ||
onSuccess: () => { | ||
sessionStorage.clear(); | ||
navigate(RoutePath.Home); | ||
location.reload(); | ||
}, | ||
onError: () => { | ||
toast.error('로그아웃에 실패했어요.'); | ||
} | ||
}); | ||
|
||
return mutation; | ||
} |
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.