forked from SanE-Seo/SaneE-SEo-Front
-
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.
feat: 닉네임 중복 검사, 회원가입 api 연동 (SanE-Seo#26)
- Loading branch information
Showing
5 changed files
with
65 additions
and
34 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 was deleted.
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,36 @@ | ||
import axios from 'axios'; | ||
|
||
// 닉네임 중복 확인을 위한 API 응답 타입을 정의합니다. | ||
type AxiosResponse = { | ||
success: boolean; | ||
message: string; | ||
data: any; | ||
}; | ||
export const CheckNicknameDuplicate = async (nickname: string) => { | ||
try { | ||
const res = await axios.get<AxiosResponse>( | ||
`/api/member/duplicate?username=${nickname}`, | ||
); | ||
console.log(res); | ||
return res; | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; | ||
|
||
export const RegisterUser = async ( | ||
email: string, | ||
password: string, | ||
nickname: string, | ||
) => { | ||
try { | ||
const res = await axios.post<AxiosResponse>('/api/auth/register', { | ||
name: nickname, | ||
password: password, | ||
email: email, | ||
}); | ||
return res; | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; |
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