fix typo
polling interval from config qrcode as link courses list page journal.pl as name fix package-lock lesson missed students merge students list reset version 1.0.0 styled page of visits rename students fake students, delete comments Обновил Readme Squashed commit of the following: commit ebc511e36b84c077f7bc029540ead1e3c58c49ab Author: Alexei <adu864222@gmail.com> Date: Tue Mar 19 00:23:30 2024 +1000 fake students, delete comments commit 018582d16c581663103e5fded99cc10fca400532 Author: Alexei <adu864222@gmail.com> Date: Mon Mar 18 23:13:01 2024 +1000 rename students commit e53922d7fd89cf371c90e167c6486b36b0789036 Author: Alexei <adu864222@gmail.com> Date: Sun Mar 17 00:45:11 2024 +1000 styled page of visits Обновил Readme Squashed commit of the following: commit ebc511e36b84c077f7bc029540ead1e3c58c49ab Author: Alexei <adu864222@gmail.com> Date: Tue Mar 19 00:23:30 2024 +1000 fake students, delete comments commit 018582d16c581663103e5fded99cc10fca400532 Author: Alexei <adu864222@gmail.com> Date: Mon Mar 18 23:13:01 2024 +1000 rename students commit e53922d7fd89cf371c90e167c6486b36b0789036 Author: Alexei <adu864222@gmail.com> Date: Sun Mar 17 00:45:11 2024 +1000 styled page of visits JRL-51 breadcrumbs + fonts 1.1.0 1.2.0 correct width h1 on page of visits students styled card of course
This commit is contained in:
@@ -2,7 +2,7 @@ import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
||||
import { getConfigValue } from "@ijl/cli";
|
||||
|
||||
import { keycloak } from "../kc";
|
||||
import { AccessCode, BaseResponse, Lesson, UserData } from "../model";
|
||||
import { AccessCode, BaseResponse, Course, Lesson, User, UserData } from "../model";
|
||||
|
||||
export const api = createApi({
|
||||
reducerPath: "auth",
|
||||
@@ -11,9 +11,7 @@ export const api = createApi({
|
||||
fetchFn: async (input: RequestInfo | URL, init?: RequestInit | undefined) => {
|
||||
const response = await fetch(input, init);
|
||||
|
||||
if (response.status === 403) {
|
||||
keycloak.login();
|
||||
}
|
||||
if (response.status === 403) keycloak.login()
|
||||
|
||||
return response;
|
||||
},
|
||||
@@ -24,23 +22,47 @@ export const api = createApi({
|
||||
headers.set('Authorization', `Bearer ${keycloak.token}`)
|
||||
}
|
||||
}),
|
||||
tagTypes: ['Lesson'],
|
||||
tagTypes: ['LessonList', 'CourseList'],
|
||||
endpoints: (builder) => ({
|
||||
lessonList: builder.query<BaseResponse<Lesson[]>, void>({
|
||||
query: () => '/lesson/list',
|
||||
providesTags: ['Lesson']
|
||||
coursesList: builder.query<BaseResponse<Course[]>, void>({
|
||||
query: () => '/course/list',
|
||||
providesTags: ['CourseList']
|
||||
}),
|
||||
createLesson: builder.mutation<BaseResponse<Lesson>, Pick<Lesson, 'name'>>({
|
||||
query: ({ name }) => ({
|
||||
createUpdateCourse: builder.mutation<BaseResponse<Course>, Partial<Course> & Pick<Course, 'name'>>({
|
||||
query: (course) => ({
|
||||
url: '/course',
|
||||
method: 'POST',
|
||||
body: course,
|
||||
}),
|
||||
invalidatesTags: ['CourseList']
|
||||
}),
|
||||
courseAllStudents: builder.query<BaseResponse<User[]>, string>({
|
||||
query: (courseId) => `/course/students/${courseId}`
|
||||
}),
|
||||
manualAddStudent: builder.mutation<BaseResponse<void>, { lessonId: string, user: User }>({
|
||||
query: ({lessonId, user}) => ({
|
||||
url: `/lesson/add-student/${lessonId}`,
|
||||
method: 'POST',
|
||||
body: user
|
||||
})
|
||||
}),
|
||||
|
||||
lessonList: builder.query<BaseResponse<Lesson[]>, string>({
|
||||
query: (courseId) => `/lesson/list/${courseId}`,
|
||||
providesTags: ['LessonList']
|
||||
}),
|
||||
createLesson: builder.mutation<BaseResponse<Lesson>, Pick<Lesson, 'name'> & { courseId: string }>({
|
||||
query: ({ name, courseId }) => ({
|
||||
url: '/lesson',
|
||||
method: 'POST',
|
||||
body: {name },
|
||||
body: { name, courseId },
|
||||
}),
|
||||
invalidatesTags: ['Lesson']
|
||||
invalidatesTags: ['LessonList']
|
||||
}),
|
||||
lessonById: builder.query<BaseResponse<Lesson>, string>({
|
||||
query: (lessonId: string) => `/lesson/${lessonId}`
|
||||
}),
|
||||
|
||||
createAccessCode: builder.query<BaseResponse<AccessCode>, { lessonId: string }>({
|
||||
query: ({ lessonId }) => ({
|
||||
url: '/lesson/access-code',
|
||||
|
||||
Reference in New Issue
Block a user