Skip to content

Commit

Permalink
Add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
Keskimaki committed Feb 24, 2023
1 parent 561cde0 commit e6b41c2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/client/hooks/useUserFaculties.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useQuery } from 'react-query'

import apiClient from '../util/apiClient'
import { Faculty } from '../types'

const useUserFaculties = () => {
const queryKey = 'userFaculties'

const query = async (): Promise<Faculty[]> => {
const { data } = await apiClient.get('/faculties/user')

return data
}

const { data: userFaculties, ...rest } = useQuery(queryKey, query)

return { userFaculties, ...rest }
}

export default useUserFaculties

0 comments on commit e6b41c2

Please sign in to comment.