-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
65 additions
and
33 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 |
---|---|---|
@@ -1 +1 @@ | ||
VITE_SERVER_API=http://3.38.6.154:8080 | ||
VITE_SERVER_API=http://ec2-3-38-6-154.ap-northeast-2.compute.amazonaws.com:8080 |
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,23 +1,36 @@ | ||
import { FormState } from "@/features/form/states/form-data-state"; | ||
import { | ||
LoginFormState, | ||
RegisterFormState, | ||
} from "@/features/form/states/form-data-state"; | ||
|
||
export function validateForm(formData: FormState): [Record<string, string>] { | ||
export function validateForm( | ||
formData: LoginFormState | RegisterFormState | ||
): [Record<string, string>] { | ||
const errorMessage: Record<string, string> = {}; | ||
const { username, userid, email, password, team, devPart } = formData; | ||
|
||
if ("username" in formData && !username?.trim()) { | ||
if ("username" in formData && !formData.username?.trim()) { | ||
errorMessage.username = "유저이름을 입력해주세요."; | ||
} | ||
|
||
if ("userid" in formData && !userid?.trim()) { | ||
if ("userid" in formData && !formData.userid?.trim()) { | ||
errorMessage.userid = "유저아이디를 입력해주세요."; | ||
} | ||
if (!email.trim()) { | ||
|
||
if (!formData.email.trim()) { | ||
errorMessage.email = "이메일을 입력해주세요."; | ||
} | ||
|
||
if (!password.trim()) { | ||
if (!formData.password.trim()) { | ||
errorMessage.password = "비밀번호를 입력해주세요."; | ||
} | ||
|
||
if ("team" in formData && formData.team === -1) { | ||
errorMessage.team = "팀을 선택해주세요."; | ||
} | ||
|
||
if ("devPart" in formData && formData.devPart === -1) { | ||
errorMessage.team = "파트를 선택해주세요."; | ||
} | ||
|
||
return [errorMessage]; | ||
} |
2 changes: 1 addition & 1 deletion
2
src/features/auth/queries/dto/login.ts → src/features/auth/queries/dto/auth-login.ts
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,4 +1,4 @@ | ||
export interface LoginRequest { | ||
export interface AuthLoginRequest { | ||
email: string; | ||
password: string; | ||
} |
4 changes: 2 additions & 2 deletions
4
src/features/auth/queries/dto/sign-up.ts → ...eatures/auth/queries/dto/auth-register.ts
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,8 +1,8 @@ | ||
export interface SignUpRequest { | ||
export interface AuthRegisterRequest { | ||
username: string; | ||
userid: string; | ||
email: string; | ||
password: string; | ||
team: number; | ||
devPart: string; | ||
devPart: number; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
export interface FormState { | ||
username?: string; | ||
userid?: string; | ||
export interface LoginFormState { | ||
email: string; | ||
password: string; | ||
team?: number; | ||
devPart?: number; | ||
} | ||
|
||
export interface RegisterFormState { | ||
username: string; | ||
userid: string; | ||
email: string; | ||
password: string; | ||
team: number; | ||
devPart: number; | ||
} |
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