Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/apis/api/course.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {baseAPI} from '../utils/instance';

export const getCourseList = async (body: object) => {
try {
const {data} = await baseAPI.get('/schedules/search', body);
return data;
} catch (error) {
console.log('get course list fail: ', error);
}
};
Comment on lines +3 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전 지금까지 컴포넌트 안에서 처리하고 있었는데, 이렇게 모듈화 하면 관리하기 편하겠네요!

20 changes: 20 additions & 0 deletions src/apis/utils/instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios from 'axios';

const baseURL = import.meta.env.VITE_BASE_URL;

export const baseAPI = axios.create({
baseURL: baseURL,
headers: {
'Content-Type': 'application/json',
},
withCredentials: true,
});

// 토큰 받아오는 작업 필요
export const authAPI = axios.create({
baseURL: baseURL,
headers: {
// Authorization: `Bearer ${token}`,
},
withCredentials: true,
});
2 changes: 1 addition & 1 deletion src/pages/index/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Box = styled.div`
`;

const Main = styled.div`
width: 100%;
width: calc(100% - 23rem);
`;

const Article = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/styles/GlobalStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const GlobalStyle = createGlobalStyle`
}
thead {
position: sticky;
top: 0;
top: -1px;
}
`;

Expand Down
15 changes: 8 additions & 7 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"baseUrl": "./src",
"paths": {
"@components/*": ["src/components/*"],
"@pages/*": ["src/pages/*"],
"@assets/*": ["src/assets/*"],
"@store/*": ["src/store/*"],
"@plugins/*": ["src/plugins/*"],
"@/*": ["./src/*"]
"@/*": ["./*"],
"@components/*": ["components/*"],
"@pages/*": ["pages/*"],
"@assets/*": ["assets/*"],
"@store/*": ["store/*"],
"@plugins/*": ["plugins/*"],
"@apis/*": ["apis/*"]
},
"allowSyntheticDefaultImports": true
},
Expand Down
10 changes: 7 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'node:path';
import {resolve} from 'node:path';
import svgr from 'vite-plugin-svgr';

// https://vitejs.dev/config/
Expand All @@ -12,7 +12,7 @@ export default defineConfig({
resolve: {
alias: [
{
find: '@src',
find: '@',
replacement: resolve(__dirname, './src'),
},
{
Expand All @@ -35,6 +35,10 @@ export default defineConfig({
find: '@plugins',
replacement: resolve(__dirname, './src/plugins'),
},
{
find: '@apis',
replacement: resolve(__dirname, './src/apis'),
},
],
},
});