diff --git a/README.md b/README.md
index 0528ef0a..2e2f1557 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,274 @@
-# tattour-client
-TBD
+# ๐ฆ TATTOUR
+
+
+
+
+
+
+## ๐ฑ ์๋น์ค ์๊ฐ
+
+### ํํ์๋ ์ ํ์ ์ฌ์ ์ ํจ๊ป, ์ปค์คํ
ํํฌ ์ฒดํ ์๋น์ค TATTOUR
+
+
+
+### ๐ ํํฌ๋ฅผ ๋ฐ๊ณ ์ถ์ ์ฌ๋๋ค์ ์ ๊ณ ๋ฏผํ๊ณ ๋ง์ค์ด๋๋ฐ ์๊ฐ์ ํ๋นํ๊ฒ ๋ ๊น?
+
+ ๋ฌธ์ ์ ์: ๋ง์์ ๋๋ ๋์์ ์ฐพ๋๋ผ๋ ๊ณผ์ฐ ๋์๊ฒ ์ด์ธ๋ฆด์ง, ํํํ์ง ์์์ง, ์ฃผ์์ ์์ ๋ฑ์ ์ด์ ๋ก ๊ธธ๊ฒ๋ 3๋
์ด์ ๊ณ ๋ฏผ๊ณผ ๋ง์ค์์ ๋ฐ๋ณตํ๋ค.
+
+
+
+
+ ๐ target
+
+- ํํฌ๋ฅผ ํ๊ณ ์ถ์ง๋ง, ๊ณผ์ฐ ํํํ์ง ์์์ง. ๊ณ ๋ฏผ๊ณผ ๋ง์ค์์ ๋ฐ๋ณตํ๋ฉฐ ๋ฆฌ์์ค๋ฅผ ํ๋นํ๋ ๊ณ ๊ฐ
+
+- ๊ณ ๋ฏผํ๋ ๋์ ๋๋ ๊ฐ์ฒด๋ฅผ [ํํฌ์คํฐ์ปค]๋ผ๋ ์๋จ์ ํตํด ๋ฏธ๋ฆฌ ๋ถ์์ ๋ถ์ฐฉํ๊ณ ์ํํ๋ฉฐ, ๋ค์ํ ๊ณ ๋ฏผ์ ์ด์ ๋ฅผ ํ์ค์ ์ผ๋ก ํด๊ฒฐํ๊ณ ํด์ํ ์ ์์ ๊ฒ์.
+
+
+
+
+
+
+๐ service flow
+
+1. ์ ์ ๋ก๊ทธ์ธ
+ - ์์
๋ก๊ทธ์ธ ๊ธฐ๋ฅ
+ - ๋ก๊ทธ์ธ ์ฑ๊ณต ์, ํ์ ์ ์ฉ ํ ํ๋ฉด์ผ๋ก ์ด๋
+
+2. `ํฌ์ธํธ`๋ฅผ ํ์ฉํ ๊ฒฐ์ ์๋น์ค
+ - ํฌ์ธํธ๊ฐ ๊ตฌ๋งค ๊ธ์ก๋ณด๋ค ์ ์ผ๋ฉด, ๊ณ์ข๋ก ๊ตฌ๋งค ๊ธ์ก์ ์ก๊ธํ์ฌ ํฌ์ธํธ ์ถฉ์ ํ ๊ฒฐ์ ๊ฐ๋ฅ
+
+3. `์ปค์คํ
๋์`์ ์ ๋ฌด์ ๋ฐ๋ผ ์ฃผ๋ฌธ ํ์ด์ง ๋ฐ ๊ธ์ก์ด ๋ฌ๋ผ์ง.
+
+4. `๋ด ํํฌ` ํ์ด์ง์์ ์ฐ ๋ชฉ๋ก๊ณผ ์ฃผ๋ฌธ ๋ชฉ๋ก ํ์ธ ๊ฐ๋ฅ.
+
+
+
+
+
+โ
solution
+๊ฐ์์ผ๋ก ์ฒดํํด๋ณธ๋ค๋ฉด, ๋ ๋์๊ฐ ์ํํด๋ณธ๋ค๋ฉด ๊ณ ๋ฏผ์ ์ฅ๋ฒฝ์ ๋ํญ ๋ฎ์ถ ์ ์์ ๊ฒ์ด๋ผ๊ณ ํ๋จํจ.
+
+- `ํจ์จ์ ์ธ` ๊ณ ๋ฏผ๊ณผ ํ์ ๐
+
+ - ํํฌ์คํฐ์ปค๋ฅผ ํตํด ํํฌ ๊ณ ๋ฏผ์ ๊ณผ์ ๋จ์ถ ๊ฐ๋ฅ.
+
+- `ํ์ค์ ์ธ` ๊ฒฐ์ ๐ก
+
+ - ์ฒดํ๊ณผ ์ํ์ ํตํด ๊ณ ๊ฐ์ ์ํฉ์ ๋ง๋ ํ์ค์ ์ธ ๊ฒฐ์ ๊ฐ๋ฅ.
+
+- `๊ฐ์ธํ ๋ง์ถคํ` ๊ฒฝํ ๐ช
+ - ๊ฐ์ธ์ด ๊ณ ๋ฏผํ๋ ์ด์ /์ํฉ์ ๋ง๋ ์ง์ ์ ์ธ ์ ํ ๋ฐ ๊ฒฐ์ ๊ฒฝํ ๊ฐ๋ฅ.
+
+
+
+์ฆ! ์๋น์๊ฐ ๊ณ ๋ฏผ๋๋ ๋ชจ๋ ๊ฒ๋ค์ ์ง์ ํํฌ์คํฐ์ปค๋ก ์ฒดํํ๋ฉฐ, ๊ณ ๋ฏผ์ ํจ์จ์ฑ์ ๋์ด๋ ์ปค์คํฐ๋ง์ด์ง๋ ํํฌ๋ฅผ ์ ํ ๋ฐ ์ฒดํ ๊ฐ๋ฅ.
+
+
+
+
+
+
+## ๐ ํต์ฌ ๊ธฐ๋ฅ ์๊ฐ
+### **1๏ธโฃ TATTOUR MAIN** : HOT CUSTOM, THEME, STYLE ์๊ฐ, ๋ค๋น๊ฒ์ด์
์ฌ์ด๋๋ฐ
+
+
+### **2๏ธโฃ TATTOUR SHOP** : ๊ณ ๊ฐ๋ค์ด ํจ๊ป ๋ง๋ ํํฌ ์คํฐ์ปค ๋๋ฌ๋ณด๊ธฐ ๋ฐ ์ฃผ๋ฌธํ๊ธฐ / ์ฃผ๋ฌธํ๊ธฐ ๊ณผ์ ์์ ์ฐํ ํํฌ๋ค์ '๋ด ํํฌ' ํ์ด์ง์์ ํ์ธ ๊ฐ๋ฅ
+
+
+### **3๏ธโฃ TATTOUR CUSTOM** : ์ํ๋ ์ ์ ๋ฐฉ์์ ๋ฐ๋ผ ์ฌ์ธํ ์ ์ฒญ์ ์์ฑ์ผ๋ก ๋๋ง์ ํํฌ ์คํฐ์ปค ๋ง๋ค๊ธฐ
+* ๋ด ๋์ ๊ทธ๋๋ก ๋ง๋ค๊ธฐ : ํํฌ์คํฐ์ปค ํฌ๊ธฐ, ๋์ ์ด๋ฏธ์ง ์ฒจ๋ถ, ํํฌ์คํฐ์ปค ์ด๋ฆ, ์์ฒญ ์ฌํญ, ์๋ ์ ํ ๊ฐ๋ฅ
+* ํํฌ์ด์๊ฒ ๋์ ์๋ขฐํ๊ธฐ : ํํฌ์คํฐ์ปค ํฌ๊ธฐ, ์ฐธ๊ณ ์ด๋ฏธ์ง ์ฒจ๋ถ, ๋ ํผ๋ฐ์ค ๋์ถฉ ๊ทธ๋ฆฌ๊ธฐ, ์์, ์ฅ๋ฅด , ์คํ์ผ, ํํฌ์คํฐ์ปค ์ด๋ฆ, ์ฃผ์ ๋ฐ ์ถ๊ฐ ์ค๋ช
, ์์ฒญ ์ฌํญ, ์๋ ์ ํ ๊ฐ๋ฅ
+
+
+
+
+
+
+
+
+## ๐๐ปโโ๏ธ ํ์ ์๊ฐ
+
+
+
+
+
+
+
+## โ๏ธ ๊ธฐ์ ์คํ
+
+
+
+| ์ญํ | ์ข
๋ฅ |
+| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Library |  |
+| Programming Language |  |
+| Styling |  |
+| State Management |  |
+| Formatting |   |
+| Version Control |   |
+
+
+
+
+
+
+
+## โ๐ป ์ปจ๋ฒค์
+
+### โจ Git ์ปจ๋ฒค์
+
+
+ 1๏ธโฃ Commit ์ปจ๋ฒค์
+
+- ๊ธฐ๋ณธ์ ์ธ๊ฒ (feat, fix, chore, ..) ์ค์ ์ ์ผ๋ก ์งํค๊ธฐ!
+
+| ์ ๋ชฉ | ๋ด์ฉ |
+| -------- | ------------------------------------------- |
+| init | ๋ธ๋์น ์ฒซ ์ปค๋ฐ |
+| feat | ์๋ก์ด ๊ธฐ๋ฅ์ ๋ํ ์ปค๋ฐ |
+| fix | ๋ฒ๊ทธ ์์ ์ ๋ํ ์ปค๋ฐ |
+| build | ๋น๋ ๊ด๋ จ ํ์ผ ์์ ์ ๋ํ ์ปค๋ฐ |
+| chore | ๊ทธ ์ธ ์์ํ ์์ ์ ๋ํ ์ปค๋ฐ |
+| docs | ๋ฌธ์ ์์ ์ ๋ํ ์ปค๋ฐ |
+| style | style: ์ฝ๋ ์คํ์ผ ํน์ ํฌ๋งท ๋ฑ์ ๊ดํ ์ปค๋ฐ |
+| refactor | ์ฝ๋ ๋ฆฌํฉํ ๋ง์ ๋ํ ์ปค๋ฐ |
+
+
+
+
+ 2๏ธโฃ Branch ์ ๋ต
+
+```
+1. feature ๋ธ๋์น๋ฅผ ํ๊ณ ํ์ด์ง ๋จ์๋ก ์ด๋ฆ ์์ฑ ex)feature/LoginPage
+
+2. feature ๋ธ๋์น ํ์์ ์ด์ ๋ฒํธ๋ฅผ ํฌํจํ ๊ธฐ๋ฅ ๋จ์ ๋ธ๋์น ์์ฑ ex)LoginPage/#6-login
+
+3. develop ๋ธ๋์น ๋ง๋ค์ด์ ํ์ด์ง ๋จ์ ๋ธ๋์น๋ dev๋ธ๋์น๋ก merge
+
+4. ๊ฐ๋ฐ์ด ์ต์ข
์ ์ผ๋ก ๋๋๋ฉด main์ dev ๋ธ๋์น merge
+
+5. ๊ฐ๋ฐ๋จ๊ณ์์ merge๊ฐ ์ด๋ฃจ์ด์ง๋ฉด develop pull ๋ฐ์์ค๊ธฐ !
+
+````
+
+
+
+
+
+### โจ Project ์ปจ๋ฒค์
+
+
+1๏ธโฃ ํด๋ ๊ตฌ์กฐ
+
+* ๊ณตํต ์ปดํฌ๋ํธ๋ฅผ ๋ถ๋ฆฌ
+* ํ์ด์ง ๋จ์๋ก ๋ฌํํ๊ฒ ๋ถ๋ฆฌ
+
+```tsx
+โโโ public ๐ ์ธ๋ค์ผ ์ด๋ฏธ์ง, ๋ก๊ณ ์ด๋ฏธ์ง ์ ์ฅ
+โโโ .eslintrc.cjs โจ ๋ฆฐํธ ์ค์
+โโโ .prettierrc.cjs โจ ํ๋ฆฌํฐ์ด ์ค์
+โโโ package.json ๐ฆ ์ค์น๋ ํจํค์ง๋ฅผ ๊ด๋ฆฌํ๋ ํ์ผ
+โโโ src
+ โโโ App.tsx โก๏ธ ์ฑ์ ๋ผ์ฐํ
๊ณผ ๊ธ๋ก๋ฒ ์คํ์ผ ์ง์
+ โ
+ โโโ main.tsx
+ โ
+ โโโ Router.tsx โก๏ธ ๋ผ์ฐํฐ ์ค์
+ โ
+ โโโ assets
+ โ โโโ icon ๐ผ ์ด๋ฏธ์ง ํ์ผ๋ค ์ ์ฅ
+ โ โโโ โโโ svgs ๐ svg ํ์ผ๋ค ์ ์ฅ
+ โ
+ โโโ components ๐ ์ปดํฌ๋ํธ๋ค ์ ์ฅ
+ โ โโโ modal ๐ ๋ชจ๋ฌ ์ปดํฌ๋ํธ๋ค
+ โ โโโ Login.tsx
+ โ
+ โโโ pages ๐ ๋ผ์ฐํ
์ ๋ณด์ฌ์ง ํ์ด์ง ์ปดํฌ๋ํธ ์ ์ฅ
+ โ โโโ LoginPage.tsx
+ โ
+ โโโ recoil ๐ ๋ฆฌ์ฝ์ผ ๊ด๋ จ ํ์ผ๋ค ์ ์ฅ
+ โ โโโ atoms ๐ atom๋ค ์ ์ฅ
+ โ โโโ seletors ๐ selector๋ค ์ ์ฅ
+ โ
+ โโโ styles ๐ ์ ์ญ ์คํ์ผ ๊ด๋ จ ํ์ผ๋ค ์ ์ฅ
+ โ โโโ GlobalStyle.js
+ โ โโโ modal.css
+ โ โโโ color.js
+ โ
+ โโโ utils ๐ util ํจ์ ๊ด๋ จ ํ์ผ๋ค ์ ์ฅ
+ โ โโโ apis ๐ api ํจ์ ๊ด๋ จ ํ์ผ๋ค ์ ์ฅ
+
+
+````
+
+
+
+
+2๏ธโฃ ๊ธฐํ ์ปจ๋ฒค์
+
+#### (1) ๐จ Style ์์ฑ
+
+```
+1. ๋ ์ด์์ ์์ฑ (display, position, float ๋ฑ)
+
+2. ๋ฐ์ค ๋ชจ๋ธ ์์ฑ (width, height, margin, padding, border ๋ฑ)
+
+3. ์๊ฐ ๊ด๋ จ ์์ฑ (background-color, background-image, box-shadow ๋ฑ)
+
+4. ๊ธ๊ผด ๊ด๋ จ ์์ฑ (font-size, font-family, color, text-align, text-transform ๋ฑ)
+
+5. ๊ธฐํ ์์ฑ (opacity, cursor, overflow, z-index, transition, animation ๋ฑ)
+```
+
+- CSS : Styled component ์ฌ์ฉ
+- theme์ globalStyle ์ฌ์ฉ (`theme` : colors, font ~ )
+- rem์ ์์ฃผ๋ก ์ ์ฉ.
+
+
+
+#### ๐ซก ๊ธฐํ ์ปจ๋ฒค์
+
+- ํ์ดํ ํจ์ํํ (`const ~~~ () => { } )` ) ๋ก ์ฌ์ฉ.
+ - `rsc` ์ปดํฌ๋ํธ ๋จ์ถํค ์ฌ์ฉ
+- event ํจ์๋ `handle(Action)(Component)`
+- ๋ณ์๋ช
: `์นด๋ฉ์ผ์ด์ค` / ์์๋ฐ์ดํฐ : `๋๋ฌธ์` / Component๋ช
:`ํ์ค์นผ`
+- ์ ๋๊ฒฝ๋ก ์ฌ์ฉ (`src` ๊ธฐ์ค)
+
+
diff --git a/src/common/Modal/CheckModal/CheckModalForm.tsx b/src/common/Modal/CheckModal/CheckModalForm.tsx
index ab97d93f..1a9937d9 100644
--- a/src/common/Modal/CheckModal/CheckModalForm.tsx
+++ b/src/common/Modal/CheckModal/CheckModalForm.tsx
@@ -1,7 +1,7 @@
import styled from 'styled-components';
import { IcCancelDark } from '../../../assets/icon';
import { useNavigate } from 'react-router-dom';
-import api from '../../../libs/api';
+import { api } from '../../../libs/api';
interface CheckModalFormProps {
onClose: () => void;
diff --git a/src/common/Modal/DeleteCartModal/DeleteCartModal.tsx b/src/common/Modal/DeleteCartModal/DeleteCartModal.tsx
index 7b75dff1..d6682b33 100644
--- a/src/common/Modal/DeleteCartModal/DeleteCartModal.tsx
+++ b/src/common/Modal/DeleteCartModal/DeleteCartModal.tsx
@@ -1,6 +1,6 @@
import ModalPortal from '../ModalPortal';
import EscapeModalForm from '../EscapeModal/EscapeModalForm';
-import api from '../../../libs/api';
+import { api } from '../../../libs/api';
import { useNavigate } from 'react-router-dom';
interface DeleteCartModalProps {
diff --git a/src/common/Modal/EscapeModal/CustomSizeEscapeModal.tsx b/src/common/Modal/EscapeModal/CustomSizeEscapeModal.tsx
index 566a34d9..1e01ca0f 100644
--- a/src/common/Modal/EscapeModal/CustomSizeEscapeModal.tsx
+++ b/src/common/Modal/EscapeModal/CustomSizeEscapeModal.tsx
@@ -3,7 +3,7 @@ import ModalPortal from '../ModalPortal';
import { IcCancelDark } from '../../../assets/icon';
import { useNavigate } from 'react-router-dom';
import { customInfoType } from '../../../types/customInfoType';
-import api from '../../../libs/api';
+import { api } from '../../../libs/api';
interface CustomSizeEscapeModalProps {
setModalOn: React.Dispatch>;
diff --git a/src/components/Cart/CartItem.tsx b/src/components/Cart/CartItem.tsx
index 4dcdf6fe..52dd1c9d 100644
--- a/src/components/Cart/CartItem.tsx
+++ b/src/components/Cart/CartItem.tsx
@@ -3,7 +3,7 @@ import { IcCancelDark, IcMinus, IcMinusOneunder, IcPlus } from '../../assets/ico
import { useState, useEffect, useCallback } from 'react';
import DeleteCartModal from '../../common/Modal/DeleteCartModal/DeleteCartModal';
import { debounce } from 'lodash';
-import api from '../../libs/api';
+import { api } from '../../libs/api';
import { useNavigate } from 'react-router-dom';
const CartItem = ({
diff --git a/src/components/Custom/Common/OnBoardingFooter.tsx b/src/components/Custom/Common/OnBoardingFooter.tsx
index c39ef14b..3f7b8a47 100644
--- a/src/components/Custom/Common/OnBoardingFooter.tsx
+++ b/src/components/Custom/Common/OnBoardingFooter.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { styled } from 'styled-components';
import TempSaveModal from '../../../common/Modal/TempSaveModal/TempSaveModal';
import { useNavigate } from 'react-router-dom';
-import api from '../../../libs/api';
+import { api } from '../../../libs/api';
import { AxiosError } from 'axios';
export interface CustomSaveItemProps {
diff --git a/src/components/Custom/PriceFooter.tsx b/src/components/Custom/PriceFooter.tsx
index 8ec7f04e..a62698ba 100644
--- a/src/components/Custom/PriceFooter.tsx
+++ b/src/components/Custom/PriceFooter.tsx
@@ -1,7 +1,7 @@
import { styled } from 'styled-components';
import { customInfoType, resCustomInfoType } from '../../types/customInfoType';
-import api from '../../libs/api';
import React from 'react';
+import { api } from '../../libs/api';
interface PriceFooterProps {
haveDesign?: boolean;
diff --git a/src/components/Detail/DetailFooter.tsx b/src/components/Detail/DetailFooter.tsx
index 9d59ee18..a4b5b15c 100644
--- a/src/components/Detail/DetailFooter.tsx
+++ b/src/components/Detail/DetailFooter.tsx
@@ -1,7 +1,7 @@
import styled from 'styled-components';
import { IcHeartDark, IcHeartLight } from '../../assets/icon';
import { useNavigate } from 'react-router-dom';
-import api from '../../libs/api';
+import { api } from '../../libs/api';
import { useState } from 'react';
import Toast from '../../common/ToastMessage/Toast';
diff --git a/src/components/MyTattoo/MySaveItem.tsx b/src/components/MyTattoo/MySaveItem.tsx
index 02412b96..8779f42a 100644
--- a/src/components/MyTattoo/MySaveItem.tsx
+++ b/src/components/MyTattoo/MySaveItem.tsx
@@ -1,6 +1,6 @@
import { styled } from 'styled-components';
import { useNavigate } from 'react-router-dom';
-import api from '../../libs/api';
+import { api } from '../../libs/api';
export interface CustomDetailItemProps {
id: number;
diff --git a/src/components/Order/OrderFooter.tsx b/src/components/Order/OrderFooter.tsx
index 7c03a15f..62e64af6 100644
--- a/src/components/Order/OrderFooter.tsx
+++ b/src/components/Order/OrderFooter.tsx
@@ -1,6 +1,6 @@
import styled from 'styled-components';
import { useNavigate } from 'react-router-dom';
-import api from '../../libs/api';
+import { api } from '../../libs/api';
import { OrderSheetProps } from '../../libs/hooks/order/useGetOrdersheet';
interface OrderRequest {
diff --git a/src/components/Register/RegisterPhoneNumForm.tsx b/src/components/Register/RegisterPhoneNumForm.tsx
index bb2a3a41..19c9b3d6 100644
--- a/src/components/Register/RegisterPhoneNumForm.tsx
+++ b/src/components/Register/RegisterPhoneNumForm.tsx
@@ -1,13 +1,12 @@
import { styled } from 'styled-components';
import React, { SetStateAction, useReducer, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
-import axios from 'axios';
-import api from '../../libs/api';
import { reducer } from '../../libs/reducers/registerReducer';
import sliceMaxLength from '../../utils/sliceMaxLength';
import Toast from '../../common/ToastMessage/Toast';
import Timer from './Timer';
import ErrorMessage from './ErrorMessage';
+import { api, baseAxios } from '../../libs/api';
interface RegisterPhoneNumFormProps {
setStep: React.Dispatch>;
@@ -80,23 +79,12 @@ const RegisterPhoneNumForm = ({ setStep }: RegisterPhoneNumFormProps) => {
// ํด๋ฆญ ์, ์ธ์ฆ๋ฒํธ๋ฅผ ๋ฐ์ ์ ์๋ ๋ฒํผ
const handleClickSendMessageBtn = () => {
- const ACCESS_TOKEN_KEY = 'accesstoken';
- const accessToken = localStorage.getItem(ACCESS_TOKEN_KEY);
-
// ์ ํ๋ฒํธ๊ฐ ์ ๋๋ก ์
๋ ฅ๋ ๊ฒฝ์ฐ์๋ง ์ธ์ฆ๋ฒํธ๋ฅผ ๋ฐ์ ์ ์์
if (phoneNum.length === 11) {
- axios
- .post(
- `https://dev.tattour.shop/sms/send/verification-code`,
- {
- phoneNumber: `${phoneNum}`,
- },
- {
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- },
- )
+ baseAxios
+ .post(`/sms/send/verification-code`, {
+ phoneNumber: `${phoneNum}`,
+ })
.then(() => {
dispatch({ type: 'SHOW_CERTIFICATION_FORM' });
setToast(true);
@@ -123,8 +111,8 @@ const RegisterPhoneNumForm = ({ setStep }: RegisterPhoneNumFormProps) => {
const checkCertificationNum = (e: React.ChangeEvent) => {
// ์ธ์ฆ๋ฒํธ 6์๋ฆฌ๋ฅผ ๋ชจ๋ ์
๋ ฅํ์ ๊ฒฝ์ฐ์๋ง ์๋ฒ์ ์ํต
if (e.target.value.length === 6) {
- api
- .get(`/user/phonenumber/verification`, {
+ baseAxios
+ .get(`/api/v1/user/phonenumber/verification`, {
params: {
verificationCode: `${e.target.value}`,
},
diff --git a/src/libs/api.ts b/src/libs/api.ts
index 72810abe..4786282c 100644
--- a/src/libs/api.ts
+++ b/src/libs/api.ts
@@ -1,10 +1,15 @@
import axios, { AxiosInstance } from 'axios';
-const api: AxiosInstance = axios.create({
+// /api/vi endpoint๊ฐ ๋ถ์ง ์์ instance
+export const baseAxios: AxiosInstance = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_URL,
// timeout: 5000, // ์ํ๋ ๊ฒฝ์ฐ ํ์์์ ์ค์
});
+export const api: AxiosInstance = axios.create({
+ baseURL: `${import.meta.env.VITE_APP_BASE_URL}/api/v1`,
+ // timeout: 5000, // ์ํ๋ ๊ฒฝ์ฐ ํ์์์ ์ค์
+});
// const ACCESS_TOKEN_KEY = 'accessToken';
const ACCESS_TOKEN_KEY = 'accesstoken';
@@ -20,7 +25,7 @@ export const removeAccessToken = () => {
localStorage.removeItem(ACCESS_TOKEN_KEY);
};
-api.interceptors.request.use((config) => {
+baseAxios.interceptors.request.use((config) => {
const accessToken = getAccessToken();
if (accessToken) {
config.headers['Authorization'] = `Bearer ${accessToken}`;
@@ -28,4 +33,10 @@ api.interceptors.request.use((config) => {
return config;
});
-export default api;
+api.interceptors.request.use((config) => {
+ const accessToken = getAccessToken();
+ if (accessToken) {
+ config.headers['Authorization'] = `Bearer ${accessToken}`;
+ }
+ return config;
+});
diff --git a/src/libs/hooks/detail/useGetRelated.tsx b/src/libs/hooks/detail/useGetRelated.tsx
index c4d65eb9..fc168b00 100644
--- a/src/libs/hooks/detail/useGetRelated.tsx
+++ b/src/libs/hooks/detail/useGetRelated.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/detail/useGetSticker.tsx b/src/libs/hooks/detail/useGetSticker.tsx
index 02510078..71761095 100644
--- a/src/libs/hooks/detail/useGetSticker.tsx
+++ b/src/libs/hooks/detail/useGetSticker.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/list/useGetAllList.tsx b/src/libs/hooks/list/useGetAllList.tsx
index 82ca449b..665e3c15 100644
--- a/src/libs/hooks/list/useGetAllList.tsx
+++ b/src/libs/hooks/list/useGetAllList.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
import { buttonType } from '../../../page/ListPage';
diff --git a/src/libs/hooks/list/useGetGenre.tsx b/src/libs/hooks/list/useGetGenre.tsx
index 7ffeeb54..7d303a4e 100644
--- a/src/libs/hooks/list/useGetGenre.tsx
+++ b/src/libs/hooks/list/useGetGenre.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/list/useGetStyle.tsx b/src/libs/hooks/list/useGetStyle.tsx
index 5cb2c67b..e2db463d 100644
--- a/src/libs/hooks/list/useGetStyle.tsx
+++ b/src/libs/hooks/list/useGetStyle.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/order/useGetOrdersheet.tsx b/src/libs/hooks/order/useGetOrdersheet.tsx
index 4ab02ae8..f9b396b6 100644
--- a/src/libs/hooks/order/useGetOrdersheet.tsx
+++ b/src/libs/hooks/order/useGetOrdersheet.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/order/usePostOrder.tsx b/src/libs/hooks/order/usePostOrder.tsx
index ece087ef..b6d13d01 100644
--- a/src/libs/hooks/order/usePostOrder.tsx
+++ b/src/libs/hooks/order/usePostOrder.tsx
@@ -1,5 +1,5 @@
import { useState } from 'react';
-import api from '../../api';
+import { api } from '../../api';
import { useNavigate } from 'react-router-dom';
export interface OrderRequest {
diff --git a/src/libs/hooks/useGetCartList.ts b/src/libs/hooks/useGetCartList.ts
index d5719a6e..3340434e 100644
--- a/src/libs/hooks/useGetCartList.ts
+++ b/src/libs/hooks/useGetCartList.ts
@@ -1,58 +1,59 @@
import { useEffect, useState } from 'react';
-import { AxiosError } from "axios";
-import api from "../api";
+import { AxiosError } from 'axios';
+import { api } from '../api';
interface CartListProps {
- cartItemsRes: CartItemProps[];
- orderAmountDetailRes: OrderAmountDetailProps;
+ cartItemsRes: CartItemProps[];
+ orderAmountDetailRes: OrderAmountDetailProps;
}
export interface CartItemProps {
- stickerId: number;
- id: number;
- mainImageUrl: string;
- name: string;
- price: number;
- discountPrice: number;
- count: number;
+ stickerId: number;
+ id: number;
+ mainImageUrl: string;
+ name: string;
+ price: number;
+ discountPrice: number;
+ count: number;
}
export interface OrderAmountDetailProps {
- totalAmount: number;
- productAmount: number;
- shippingFee: number;
+ totalAmount: number;
+ productAmount: number;
+ shippingFee: number;
}
interface CartListResponse {
- data: CartListProps
- code: number;
- message: string;
+ data: CartListProps;
+ code: number;
+ message: string;
}
const useGetCartList = () => {
- const [response, setResponse] = useState({} as CartListProps);
- const [error, setError] = useState();
- const [loading, setLoading] = useState(true);
-
- const fetchData = async () => {
- await api.get('/cart')
- .then(res => {
- const data: CartListResponse = res.data;
- setResponse(data.data);
- })
- .catch(err => {
- setError(err);
- })
- .finally(() => {
- setLoading(false);
- })
- }
-
- useEffect(() => {
- fetchData();
- }, [])
-
- return { response, error, loading }
-}
+ const [response, setResponse] = useState({} as CartListProps);
+ const [error, setError] = useState();
+ const [loading, setLoading] = useState(true);
+
+ const fetchData = async () => {
+ await api
+ .get('/cart')
+ .then((res) => {
+ const data: CartListResponse = res.data;
+ setResponse(data.data);
+ })
+ .catch((err) => {
+ setError(err);
+ })
+ .finally(() => {
+ setLoading(false);
+ });
+ };
+
+ useEffect(() => {
+ fetchData();
+ }, []);
+
+ return { response, error, loading };
+};
export default useGetCartList;
diff --git a/src/libs/hooks/useGetCustomDetail.ts b/src/libs/hooks/useGetCustomDetail.ts
index c5888b0c..97106a18 100644
--- a/src/libs/hooks/useGetCustomDetail.ts
+++ b/src/libs/hooks/useGetCustomDetail.ts
@@ -1,6 +1,6 @@
import { AxiosError } from 'axios';
import { useEffect, useState } from 'react';
-import api from '../api';
+import { api } from '../api';
import { useNavigate } from 'react-router-dom';
export interface CustomDetailItemProps {
diff --git a/src/libs/hooks/useGetCustomSaveList.ts b/src/libs/hooks/useGetCustomSaveList.ts
index 1c9a3c28..a1a51a42 100644
--- a/src/libs/hooks/useGetCustomSaveList.ts
+++ b/src/libs/hooks/useGetCustomSaveList.ts
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import api from '../api';
+import { api } from '../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/useGetHotCustom.ts b/src/libs/hooks/useGetHotCustom.ts
index 29480fb8..63b78464 100644
--- a/src/libs/hooks/useGetHotCustom.ts
+++ b/src/libs/hooks/useGetHotCustom.ts
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import api from '../api';
+import { api } from '../api';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/useGetLikeSticker.ts b/src/libs/hooks/useGetLikeSticker.ts
index c8ac9c12..8817c4a2 100644
--- a/src/libs/hooks/useGetLikeSticker.ts
+++ b/src/libs/hooks/useGetLikeSticker.ts
@@ -1,5 +1,5 @@
import { AxiosError } from 'axios';
-import api from '../api';
+import { api } from '../api';
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/useGetMyCustom.ts b/src/libs/hooks/useGetMyCustom.ts
index e29a9a6d..96236cf2 100644
--- a/src/libs/hooks/useGetMyCustom.ts
+++ b/src/libs/hooks/useGetMyCustom.ts
@@ -1,6 +1,6 @@
import { AxiosError } from 'axios';
import { useEffect, useState } from 'react';
-import api from '../api';
+import { api } from '../api';
import { useNavigate } from 'react-router-dom';
export interface MyCustomItemProps {
diff --git a/src/libs/hooks/useGetSearchSticker.ts b/src/libs/hooks/useGetSearchSticker.ts
index d02b6483..752dc3e3 100644
--- a/src/libs/hooks/useGetSearchSticker.ts
+++ b/src/libs/hooks/useGetSearchSticker.ts
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { AxiosError } from 'axios';
-import api from '../api';
+import { api } from '../api';
import { useNavigate } from 'react-router-dom';
export interface SearchStickerItemProps {
diff --git a/src/libs/hooks/useGetStyleCard.ts b/src/libs/hooks/useGetStyleCard.ts
index cbcc0aec..a3e0f042 100644
--- a/src/libs/hooks/useGetStyleCard.ts
+++ b/src/libs/hooks/useGetStyleCard.ts
@@ -1,6 +1,6 @@
import { AxiosError } from 'axios';
import { useEffect, useState } from 'react';
-import api from '../api';
+import { api } from '../api';
import { useNavigate } from 'react-router-dom';
export interface MainStyleItemProps {
diff --git a/src/libs/hooks/useGetThemeCard.ts b/src/libs/hooks/useGetThemeCard.ts
index 9cfcf8bf..8ee5e2f2 100644
--- a/src/libs/hooks/useGetThemeCard.ts
+++ b/src/libs/hooks/useGetThemeCard.ts
@@ -1,6 +1,6 @@
import { AxiosError } from 'axios';
import { useEffect, useState } from 'react';
-import api from '../api';
+import { api } from '../api';
import { useNavigate } from 'react-router-dom';
export interface MainThemeItemProps {
diff --git a/src/libs/hooks/useGetUserProfile.ts b/src/libs/hooks/useGetUserProfile.ts
index 3050c560..0e3b7717 100644
--- a/src/libs/hooks/useGetUserProfile.ts
+++ b/src/libs/hooks/useGetUserProfile.ts
@@ -1,4 +1,4 @@
-import api from '../api';
+import { api } from '../api';
import { useState, useEffect } from 'react';
import { AxiosError } from 'axios';
import { useNavigate } from 'react-router-dom';
diff --git a/src/libs/hooks/useKakaoLogin.tsx b/src/libs/hooks/useKakaoLogin.tsx
index d3eb2df9..ed566198 100644
--- a/src/libs/hooks/useKakaoLogin.tsx
+++ b/src/libs/hooks/useKakaoLogin.tsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
-import api, { setAccessToken } from '../api';
+import { api, setAccessToken } from '../api';
interface resProps {
data: {
diff --git a/src/libs/hooks/usePostCustomApply.ts b/src/libs/hooks/usePostCustomApply.ts
index eb476c39..2cce0aab 100644
--- a/src/libs/hooks/usePostCustomApply.ts
+++ b/src/libs/hooks/usePostCustomApply.ts
@@ -1,7 +1,7 @@
import { AxiosError, isAxiosError } from 'axios';
import { useEffect, useState } from 'react';
-import api from '../api';
import { useNavigate } from 'react-router-dom';
+import { api } from '../api';
interface CustomApplyResponseData {
customId: number;