-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0e83b4
commit 51c1640
Showing
20 changed files
with
269 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useQuery, useSuspenseQuery } from "@tanstack/react-query"; | ||
|
||
import { ApiClient } from "../api-client"; | ||
|
||
import type { GetTutorCoursesResponse } from "../generated-api"; | ||
|
||
export const tutorCourses = (authorId: string) => { | ||
return { | ||
queryKey: ["tutor-courses", authorId], | ||
queryFn: async () => { | ||
const response = await ApiClient.api.coursesControllerGetTutorCourses({ authorId }); | ||
|
||
return response.data; | ||
}, | ||
select: (data: GetTutorCoursesResponse) => data.data, | ||
}; | ||
}; | ||
|
||
export function useTutorCourses(authorId: string) { | ||
return useQuery(tutorCourses(authorId)); | ||
} | ||
|
||
export function useTutorCoursesSuspense(authorId: string) { | ||
return useSuspenseQuery(tutorCourses(authorId)); | ||
} |
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,25 @@ | ||
import { useQuery, useSuspenseQuery } from "@tanstack/react-query"; | ||
|
||
import { ApiClient } from "../api-client"; | ||
|
||
import type { GetUserDetailsResponse } from "../generated-api"; | ||
|
||
export const userDetails = (userId: string) => { | ||
return { | ||
queryKey: ["user-details", userId], | ||
queryFn: async () => { | ||
const response = await ApiClient.api.usersControllerGetUserDetails({ userId }); | ||
|
||
return response.data; | ||
}, | ||
select: (data: GetUserDetailsResponse) => data.data, | ||
}; | ||
}; | ||
|
||
export function useUserDetails(userId: string) { | ||
return useQuery(userDetails(userId)); | ||
} | ||
|
||
export function useUserDetailsSuspense(userId: string) { | ||
return useSuspenseQuery(userDetails(userId)); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
Oops, something went wrong.