Skip to content

Commit

Permalink
Merge branch 'dev' into feature-임수혁
Browse files Browse the repository at this point in the history
  • Loading branch information
foxholic9 authored Jun 11, 2024
2 parents 2091887 + 8a98420 commit 6c2c712
Show file tree
Hide file tree
Showing 93 changed files with 3,236 additions and 708 deletions.
121 changes: 114 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"dependencies": {
"axios": "^1.7.2",
"classnames": "^2.5.1",
"date-fns": "^3.6.0",
"react": "^18.2.0",
"react-datepicker": "^6.9.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.5",
"react-router-dom": "^6.23.1",
Expand All @@ -22,6 +24,7 @@
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/react": "^18.2.66",
"@types/react-datepicker": "^6.2.0",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
Expand Down
4 changes: 4 additions & 0 deletions public/icon/add_image_box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/icon/checked_gray.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 12 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DashboardForId from './pages/dashboard.{dashboardid}';
import Login from './pages/login-signup/login/Login';
import SignUp from './pages/login-signup/signup/SignUp';
import MyPage from './pages/mypage/MyPage';
import { DashboardProvider } from './contexts/DashboardContext';

/*
페이지 라우팅 분리,
Expand All @@ -16,15 +17,17 @@ import MyPage from './pages/mypage/MyPage';
function App() {
return (
<BrowserRouter>
<Routes>
<Route index element={<Home />} />
<Route path="/mydashboard" element={<MyDashboard />} />
<Route path="/dashboard/1/edit" element={<DashboardEdit />} />
<Route path="/dashboard/1" element={<DashboardForId />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<SignUp />} />
<Route path="/mypage" element={<MyPage />} />
</Routes>
<DashboardProvider>
<Routes>
<Route index element={<Home />} />
<Route path="/mydashboard" element={<MyDashboard />} />
<Route path="/dashboard/1/edit" element={<DashboardEdit />} />
<Route path="/dashboard/:id" element={<DashboardForId />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<SignUp />} />
<Route path="/mypage" element={<MyPage />} />
</Routes>
</DashboardProvider>
</BrowserRouter>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/api/apiModule.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export * from './authorization/apiAuth';
export * from './cards/apiCards';
export * from './columns/apiColumns';
export * from './comments/apiComments';
export * from './dashboards/apiDashboards';
export * from './invitations/apiInvitations';
export * from './members/apiMembers';
Expand Down
33 changes: 12 additions & 21 deletions src/api/authorization/apiAuth.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
import instance from '../axiosInstance';
import { handleResponse } from '../errorHandler';

interface LoginBody {
export interface LoginBody {
email: string;
password: string;
}

interface ChangePasswordBody {
export interface ChangePasswordBody {
password: string;
newPassword: string;
}

interface LoginResponse {
status: number;
message?: string;
user?: {
export interface LoginResponse {
user: {
id: number;
email: string;
nickname: string;
profileImageUrl?: string;
createdAt: string;
updatedAt: string;
};
accessToken?: string;
}

interface ChangePasswordResponse {
status: number;
message?: string;
accessToken: string;
}

// 로그인 요청 api
export async function apiLoginRequest(body: LoginBody): Promise<LoginResponse> {
const res = await instance.post<LoginResponse>('/auth/login', body);
const responseData = await handleResponse(res);
localStorage.setItem('Token', responseData.accessToken);
return handleResponse(res);
const token = responseData.accessToken;
if (token) {
localStorage.setItem('Token', token);
}
return responseData;
}

// 비밀번호 변경 요청 api
export async function apiChangePassword(
body: ChangePasswordBody,
): Promise<string | ChangePasswordResponse> {
const res = await instance.put<ChangePasswordResponse>(
'/auth/password',
body,
);
export async function apiChangePassword(body: ChangePasswordBody) {
const res = await instance.put('/auth/password', body);
return handleResponse(res);
}
Loading

0 comments on commit 6c2c712

Please sign in to comment.