From 90d6307c9a37928da46180dc16c42046011ddacb Mon Sep 17 00:00:00 2001 From: celine Date: Wed, 1 Oct 2025 16:36:56 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat:=20api,=20shop,=20user=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=A0=95=EC=9D=98=20#10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/api.ts | 37 +++++++++++++++++++++++++++++++++++++ src/types/index.ts | 0 src/types/shop.ts | 16 ++++++++++++++++ src/types/user.ts | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 src/types/api.ts delete mode 100644 src/types/index.ts create mode 100644 src/types/shop.ts create mode 100644 src/types/user.ts diff --git a/src/types/api.ts b/src/types/api.ts new file mode 100644 index 0000000..99805b7 --- /dev/null +++ b/src/types/api.ts @@ -0,0 +1,37 @@ +import { User } from './user'; + +/* -------------------- 공통 타입 -------------------- */ +export interface Link { + rel: string; + description: string; + method: 'GET' | 'POST' | 'PUT' | 'DELETE'; + href: string; +} + +export interface PaginatedResponse { + offset: number; + limit: number; + count: number; + hasNext: boolean; + items: T[]; + links: Link[]; +} + +export interface ApiResponse { + item: T; + links: Link[]; +} + +export interface ApiError { + message: string; +} + +export interface AuthRequest { + email: string; + password: string; +} + +export interface AuthResponse { + token: string; + user: { item: User; href: string }; +} diff --git a/src/types/index.ts b/src/types/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/types/shop.ts b/src/types/shop.ts new file mode 100644 index 0000000..5e340cb --- /dev/null +++ b/src/types/shop.ts @@ -0,0 +1,16 @@ +import { User } from './user'; + +export interface Shop { + id: string; + name: string; + category: string; + address1: string; + address2: string; + description: string; + imageUrl: string; + originalHourlyPay: number; + user?: { + item: User; + href?: string; + }; +} diff --git a/src/types/user.ts b/src/types/user.ts new file mode 100644 index 0000000..6e1dfc7 --- /dev/null +++ b/src/types/user.ts @@ -0,0 +1,32 @@ +import { ApiResponse, AuthRequest, AuthResponse } from './api'; +import { Shop } from './shop'; + +/* -------------------- 로그인 -------------------- */ + +export type LoginRequest = AuthRequest; + +export type LoginResponse = ApiResponse; + +/* ------------------- 회원가입 ------------------ */ + +export type UserRequest = AuthRequest & { + type: UserType; +}; + +export type UserResponse = ApiResponse; + +/* -------------------- 유저 -------------------- */ +export type UserType = 'employer' | 'employee'; + +export interface UserBase { + id: string; + email: string; + type: UserType; +} +export interface User extends UserBase { + name?: string; + phone?: string; + address?: string; + bio?: string; + shop?: { item: Shop } | null; +} From 34496a651eda5764d5a95f80cd21f185e09a997b Mon Sep 17 00:00:00 2001 From: celine Date: Wed, 1 Oct 2025 17:11:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20chore:=20axios=20=EC=9D=B8?= =?UTF-8?q?=EC=8A=A4=ED=84=B4=EC=8A=A4=EC=97=90=20withCredentials=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/axios/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/axios/index.ts b/src/lib/axios/index.ts index 68af766..9b2b298 100644 --- a/src/lib/axios/index.ts +++ b/src/lib/axios/index.ts @@ -2,5 +2,6 @@ import baseAxios from 'axios'; const axiosInstance = baseAxios.create({ baseURL: process.env.NEXT_PUBLIC_API_URL, + withCredentials: true, }); export default axiosInstance;