-
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.
refactor: react-query 적용 (professor)
- Loading branch information
1 parent
2431352
commit 3b2025d
Showing
5 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
apps/community/src/apis/member/professor/professor-service.ts
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,11 @@ | ||
import { MOCK_END_POINT } from '~/constants/api'; | ||
import type { Professor } from '~/types/professor'; | ||
import { http } from '~/utils/http'; | ||
|
||
class ProfessorService { | ||
getProfessors() { | ||
return http.get<Professor[]>(MOCK_END_POINT.PROFESSORS); | ||
} | ||
} | ||
|
||
export default new ProfessorService(); |
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,14 @@ | ||
import ProfessorService from './professor-service'; | ||
|
||
const queryKeys = { | ||
all: ['contacts'] as const, | ||
}; | ||
|
||
const professorQueryOptions = { | ||
all: () => ({ | ||
queryKey: queryKeys.all, | ||
queryFn: () => ProfessorService.getProfessors(), | ||
}), | ||
}; | ||
|
||
export { professorQueryOptions }; |
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,10 @@ | ||
interface Professor { | ||
id: number; | ||
name: string; | ||
img?: string; | ||
type: string; | ||
contact: string; | ||
email: string; | ||
} | ||
|
||
export type { Professor }; |