-
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.
- Loading branch information
Showing
25 changed files
with
248 additions
and
59 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
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
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export async function emailCheck(nickname: string) { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_LOCAL_BASE_URL}/user/email?email=${nickname}`, { | ||
method: 'GET', | ||
headers: { | ||
accept: 'application/json', | ||
}, | ||
cache: 'no-store', | ||
}) | ||
|
||
if (!res.ok) { | ||
throw new Error('Failed to fetch data') | ||
} | ||
|
||
return res.json() | ||
} |
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,4 @@ | ||
export { emailCheck } from './email-check' | ||
export { nicknameCheck } from './nickname-check' | ||
export { signIn } from './sign-in' | ||
export { signUp } from './sign-up' |
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,15 @@ | ||
export async function nicknameCheck(nickname: string) { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_LOCAL_BASE_URL}/user/nickname?nickname=${nickname}`, { | ||
method: 'GET', | ||
headers: { | ||
accept: 'application/json', | ||
}, | ||
cache: 'no-store', | ||
}) | ||
|
||
if (!res.ok) { | ||
throw new Error('Failed to fetch data') | ||
} | ||
|
||
return res.json() | ||
} |
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,21 @@ | ||
interface BodyData { | ||
email: string | ||
pw: string | ||
} | ||
|
||
export async function signIn(bodyData: BodyData) { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_LOCAL_BASE_URL}/user/sign-in`, { | ||
method: 'POST', | ||
headers: { | ||
accept: 'application/json', | ||
}, | ||
body: JSON.stringify(bodyData), | ||
cache: 'no-store', | ||
}) | ||
|
||
if (!res.ok) { | ||
throw new Error('Failed to fetch data') | ||
} | ||
|
||
return res.json() | ||
} |
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,22 @@ | ||
interface BodyData { | ||
nickname: string | ||
email: string | ||
pw: string | ||
} | ||
|
||
export async function signUp(bodyData: BodyData) { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_LOCAL_BASE_URL}/user/sign-up`, { | ||
method: 'POST', | ||
headers: { | ||
accept: 'application/json', | ||
}, | ||
body: JSON.stringify(bodyData), | ||
cache: 'no-store', | ||
}) | ||
|
||
if (!res.ok) { | ||
throw new Error('Failed to fetch data') | ||
} | ||
|
||
return res.json() | ||
} |
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 { signInFormSchema } from './sign-in-form-schema' | ||
export { signUpFormSchema } from './sign-up-form-schema' | ||
export { emailSchema, nicknameSchema, passwordSchema } from './user-schema' |
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 @@ | ||
import { z } from 'zod' | ||
|
||
import { email, password } from './user-schema' | ||
import { emailSchema, passwordSchema } from './user-schema' | ||
|
||
export const signInFormSchema = z.object({ | ||
email, | ||
password, | ||
email: emailSchema, | ||
password: passwordSchema, | ||
}) |
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,13 +1,13 @@ | ||
import { z } from 'zod' | ||
|
||
export const email = z.string().email({ message: '이메일 형식에 맞춰 작성해주세요' }) | ||
export const emailSchema = z.string().email({ message: '이메일 형식에 맞춰 작성해주세요' }) | ||
|
||
export const nickname = z | ||
export const nicknameSchema = z | ||
.string() | ||
.min(2, { message: '최소 2글자 이상의 닉네임을 작성해주세요' }) | ||
.max(6, { message: '최소 6글자 미만의 닉네임을 작성해주세요' }) | ||
|
||
export const password = z | ||
export const passwordSchema = z | ||
.string() | ||
.min(6, { message: '최소 6글자 이상의 비밀번호를 작성해주세요' }) | ||
.max(20, { message: '최대 20글자 이하의 비밀번호를 작성해주세요' }) |
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.