1+ import { axiosInstance } from "@/utils/axiosInstance" ;
2+
3+ export type SignOutResponse = Record < string , never > ;
4+
5+ export type SignOutRequest = Record < string , never > ;
6+
7+ export interface AppleAuthResponse {
8+ isRegistered : boolean ;
9+ nickname : null ;
10+ email : string ;
11+ profileImageUrl : null ;
12+ signUpToken : string ;
13+ }
14+
15+ export type AppleAuthRequest = Record < string , never > ;
16+
17+ export interface RefreshTokenResponse {
18+ accessToken : string ;
19+ }
20+
21+ export type RefreshTokenRequest = Record < string , never > ;
22+
23+ export interface EmailLoginResponse {
24+ accessToken : string ;
25+ refreshToken : string ;
26+ }
27+
28+ export type EmailLoginRequest = Record < string , never > ;
29+
30+ export interface EmailVerificationResponse {
31+ signUpToken : string ;
32+ }
33+
34+ export type EmailVerificationRequest = Record < string , never > ;
35+
36+ export interface KakaoAuthResponse {
37+ isRegistered : boolean ;
38+ nickname : string ;
39+ email : string ;
40+ profileImageUrl : string ;
41+ signUpToken : string ;
42+ }
43+
44+ export type KakaoAuthRequest = Record < string , never > ;
45+
46+ export type AccountResponse = void ;
47+
48+ export interface SignUpResponse {
49+ accessToken : string ;
50+ refreshToken : string ;
51+ }
52+
53+ export type SignUpRequest = Record < string , never > ;
54+
55+ export const authApi = {
56+ postSignOut : async ( params : { data ?: SignOutRequest } ) : Promise < SignOutResponse > => {
57+ const res = await axiosInstance . post < SignOutResponse > (
58+ `{` , params ?. data
59+ ) ;
60+ return res . data ;
61+ } ,
62+
63+ postAppleAuth : async ( params : { data ?: AppleAuthRequest } ) : Promise < AppleAuthResponse > => {
64+ const res = await axiosInstance . post < AppleAuthResponse > (
65+ `{` , params ?. data
66+ ) ;
67+ return res . data ;
68+ } ,
69+
70+ postRefreshToken : async ( params : { data ?: RefreshTokenRequest } ) : Promise < RefreshTokenResponse > => {
71+ const res = await axiosInstance . post < RefreshTokenResponse > (
72+ `{` , params ?. data
73+ ) ;
74+ return res . data ;
75+ } ,
76+
77+ postEmailLogin : async ( params : { data ?: EmailLoginRequest } ) : Promise < EmailLoginResponse > => {
78+ const res = await axiosInstance . post < EmailLoginResponse > (
79+ `{` , params ?. data
80+ ) ;
81+ return res . data ;
82+ } ,
83+
84+ postEmailVerification : async ( params : { data ?: EmailVerificationRequest } ) : Promise < EmailVerificationResponse > => {
85+ const res = await axiosInstance . post < EmailVerificationResponse > (
86+ `{` , params ?. data
87+ ) ;
88+ return res . data ;
89+ } ,
90+
91+ postKakaoAuth : async ( params : { data ?: KakaoAuthRequest } ) : Promise < KakaoAuthResponse > => {
92+ const res = await axiosInstance . post < KakaoAuthResponse > (
93+ `{` , params ?. data
94+ ) ;
95+ return res . data ;
96+ } ,
97+
98+ deleteAccount : async ( ) : Promise < AccountResponse > => {
99+ const res = await axiosInstance . delete < AccountResponse > (
100+ `{`
101+ ) ;
102+ return res . data ;
103+ } ,
104+
105+ postSignUp : async ( params : { data ?: SignUpRequest } ) : Promise < SignUpResponse > => {
106+ const res = await axiosInstance . post < SignUpResponse > (
107+ `{` , params ?. data
108+ ) ;
109+ return res . data ;
110+ } ,
111+
112+ } ;
0 commit comments