fix
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { useMutation, useQuery } from '@tanstack/vue-query'
|
||||
import {
|
||||
apiShowStudentExam,
|
||||
apiStartStudentExamAttempt,
|
||||
apiSubmitStudentExamAttempt,
|
||||
} from '@/services/api/student-exams'
|
||||
|
||||
export const studentExamsKeys = {
|
||||
detail: (id) => ['student', 'exams', 'detail', id],
|
||||
}
|
||||
|
||||
export const useStudentExamQuery = (idRef, options = {}) =>
|
||||
useQuery({
|
||||
queryKey: ['student', 'exams', 'detail', idRef],
|
||||
queryFn: () => apiShowStudentExam(idRef.value),
|
||||
select: (response) => response?.data ?? response,
|
||||
...options,
|
||||
})
|
||||
|
||||
export const useStartStudentExamAttemptMutation = () =>
|
||||
useMutation({ mutationFn: ({ id }) => apiStartStudentExamAttempt(id) })
|
||||
|
||||
export const useSubmitStudentExamAttemptMutation = () =>
|
||||
useMutation({
|
||||
mutationFn: ({ id, payload }) => apiSubmitStudentExamAttempt(id, payload),
|
||||
})
|
||||
Reference in New Issue
Block a user