-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Fix] context 대신 백에서 정보 불러와 기능 구현으로 수정
- Loading branch information
Showing
16 changed files
with
164 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
import './App.css'; | ||
import { router } from './routes/Router'; | ||
import { RouterProvider } from 'react-router-dom'; | ||
import { RoomProvider } from './context/RoomContext'; | ||
|
||
function App() { | ||
return ( | ||
<RoomProvider> | ||
<RouterProvider router={router} /> | ||
</RoomProvider> | ||
); | ||
return <RouterProvider router={router} />; | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import instance from './axios'; | ||
import { RoomInfo } from '../models/room.model'; | ||
|
||
// 과외방 리스트 출력 | ||
export const getRoomList = async () => { | ||
const res = await instance.get('/api/v1/rooms'); | ||
return res.data.rooms; | ||
}; | ||
|
||
// 과외방 정보 출력(수정 시) | ||
export const getCurrentRoomInfo = async (roomId: number) => { | ||
const res = await instance.get(`/api/v1/rooms/${roomId}/info`); | ||
return res.data; | ||
}; | ||
|
||
// 과외방 생성 | ||
export const postRoomInfo = async (roomInfo: RoomInfo) => { | ||
const res = await instance.post('/api/v1/rooms', roomInfo); | ||
return res.data.roomId; | ||
}; | ||
|
||
// 과외방 수정 | ||
export const patchRoomInfo = async (roomInfo: RoomInfo, roomId: number) => { | ||
const res = await instance.post(`/api/v1/rooms/${roomId}`, roomInfo); | ||
return res.status; | ||
}; | ||
|
||
// 과외방 삭제 | ||
export const deleteRoom = async (roomId: number) => { | ||
const res = await instance.delete(`/api/v1/rooms/${roomId}`); | ||
return res.status; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export interface LessonDay { | ||
id: number; | ||
lessonDay: string; | ||
} | ||
|
||
export interface SimpleLessonDay { | ||
lessonDay: string; | ||
} | ||
|
||
export interface Permission { | ||
id: number; | ||
type: string; | ||
title: string; | ||
} | ||
|
||
export interface SimplePermission { | ||
lecture_file: boolean; | ||
homework: boolean; | ||
gradeStatistic: boolean; | ||
counselingLog: boolean; | ||
deposit: boolean; | ||
} | ||
|
||
export interface RoomInfo { | ||
roomName: string; | ||
studentName: string; | ||
subject: string; | ||
lessonDays: SimpleLessonDay[]; | ||
studentPermissions: SimplePermission; | ||
parentPermissions: SimplePermission; | ||
} | ||
|
||
export interface SimpleRoomInfo { | ||
roomId: number; | ||
roomName: string; | ||
studentName: string; | ||
subject: string; | ||
student: { | ||
profileImgUrl: string; // 이부분 아직 확실 x | ||
}; | ||
} | ||
|
||
export interface Room { | ||
roomId: number; | ||
roomName: string; | ||
studentName: string; | ||
subject: string; | ||
lessonDays: SimpleLessonDay[]; | ||
studentPermissions: SimplePermission; | ||
parentPermissions: SimplePermission; | ||
} | ||
|
||
export type OnSubmit = (room: RoomInfo) => void; |
Oops, something went wrong.