File tree 7 files changed +22
-30
lines changed
create-study/@modal/(.)created-study-check
7 files changed +22
-30
lines changed Original file line number Diff line number Diff line change 1
1
import { fetcher } from "@wow-class/utils" ;
2
- import { apiPath , mentorApiPath } from "constants/apiPath" ;
2
+ import { apiPath } from "constants/apiPath" ;
3
3
import { tags } from "constants/tags" ;
4
4
import type { DashboardApiResponseDto } from "types/dtos/auth" ;
5
- import type { MyStudyListApiResponseDto } from "types/dtos/studyList" ;
6
5
7
6
export const dashboardApi = {
8
7
getDashboardInfo : async ( ) => {
@@ -19,14 +18,4 @@ export const dashboardApi = {
19
18
20
19
return { studyRole, manageRole } ;
21
20
} ,
22
- getMyStudyList : async ( ) => {
23
- const response = await fetcher . get < MyStudyListApiResponseDto [ ] > (
24
- mentorApiPath . studyList ,
25
- {
26
- next : { tags : [ tags . dashboard ] } ,
27
- cache : "force-cache" ,
28
- }
29
- ) ;
30
- return response . data ;
31
- } ,
32
21
} ;
Original file line number Diff line number Diff line change @@ -24,6 +24,16 @@ export const studyApi = {
24
24
25
25
return response . data ;
26
26
} ,
27
+ getMyStudyList : async ( ) => {
28
+ const response = await fetcher . get < StudyListApiResponseDto [ ] > (
29
+ mentorApiPath . studyList ,
30
+ {
31
+ next : { tags : [ tags . myStudyList ] } ,
32
+ cache : "force-cache" ,
33
+ }
34
+ ) ;
35
+ return response . data ;
36
+ } ,
27
37
getStudyBasicInfo : async ( studyId : number ) => {
28
38
const response = await fetcher . get < StudyBasicInfoApiResponseDto > (
29
39
`/common/studies/${ studyId } ` ,
Original file line number Diff line number Diff line change 1
1
import { css } from "@styled-system/css" ;
2
2
import { studyApi } from "apis/study/studyApi" ;
3
+ import isAdmin from "utils/isAdmin" ;
3
4
4
5
import EmptyStudyList from "./EmptyStudyList" ;
5
6
import StudyListItem from "./StudyListItem" ;
6
7
7
8
const StudyList = async ( ) => {
8
- const studyList = await studyApi . getStudyList ( ) ;
9
+ const adminStatus = await isAdmin ( ) ;
10
+ const studyList = adminStatus
11
+ ? await studyApi . getStudyList ( )
12
+ : await studyApi . getMyStudyList ( ) ;
9
13
10
14
if ( studyList ?. length === 0 ) {
11
15
return < EmptyStudyList /> ;
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const CreatedStudyCheckModal = () => {
31
31
32
32
if ( result . success ) {
33
33
await revalidateTagByName ( tags . studyList ) ;
34
+ await revalidateTagByName ( tags . myStudyList ) ;
34
35
window . alert ( "스터디 생성에 성공했어요." ) ;
35
36
router . push ( `${ routerPath . root . href } ` ) ;
36
37
} else {
Original file line number Diff line number Diff line change 1
1
import { css } from "@styled-system/css" ;
2
2
import { NavItem } from "@wow-class/ui" ;
3
- import { dashboardApi } from "apis/auth/dashboardApi" ;
4
3
import { studyApi } from "apis/study/studyApi" ;
5
4
import { clientUrl } from "constants/url" ;
6
5
import Image from "next/image" ;
@@ -18,9 +17,10 @@ import participantImageUrl from "../public/images/particpant.svg";
18
17
*/
19
18
20
19
const Navbar = async ( ) => {
21
- const studyList = ( await isAdmin ( ) )
20
+ const adminStatus = await isAdmin ( ) ;
21
+ const studyList = adminStatus
22
22
? await studyApi . getStudyList ( )
23
- : await dashboardApi . getMyStudyList ( ) ;
23
+ : await studyApi . getMyStudyList ( ) ;
24
24
25
25
const navMenu = [
26
26
{
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export const enum tags {
3
3
assignments = "assignments" ,
4
4
curriculums = "curriculums" ,
5
5
studyList = "studyList" ,
6
+ myStudyList = "myStudyList" ,
6
7
studyBasicInfo = "studyBasicInfo" ,
7
8
announcements = "announcements" ,
8
9
memberList = "memberList" ,
Original file line number Diff line number Diff line change 1
1
import type { DayOfWeekType } from "types/entities/dayofweek" ;
2
- import type {
3
- StudyKoreanType ,
4
- StudySemesterType ,
5
- StudyType ,
6
- } from "types/entities/study" ;
2
+ import type { StudyKoreanType , StudySemesterType } from "types/entities/study" ;
7
3
import type { TimeType } from "types/entities/time" ;
8
4
9
5
export interface StudyListApiResponseDto {
@@ -20,12 +16,3 @@ export interface StudyListApiResponseDto {
20
16
totalWeek : number ;
21
17
openingDate : string ;
22
18
}
23
-
24
- export interface MyStudyListApiResponseDto {
25
- studyId : number ;
26
- semester : string ;
27
- title : string ;
28
- studyType : StudyType ;
29
- notionLink : string ;
30
- mentorName : string ;
31
- }
You can’t perform that action at this time.
0 commit comments