show lemma and tactic docs

This commit is contained in:
Alexander Bentkamp
2023-02-09 15:34:37 +01:00
parent 891d51829c
commit 116026428f
6 changed files with 119 additions and 20 deletions
+10 -1
View File
@@ -20,6 +20,12 @@ interface LevelInfo {
descrFormat: null|string,
}
interface Doc {
name: string,
text: string
}
const customBaseQuery = async (
args : {method: string, params?: any},
{ signal, dispatch, getState, extra },
@@ -48,9 +54,12 @@ export const apiSlice = createApi({
loadLevel: builder.query<LevelInfo, {world: string, level: number}>({
query: ({world, level}) => {return {method: "loadLevel", params: {world, level}}},
}),
loadDoc: builder.query<Doc, {name: string, type: "lemma"|"tactic"}>({
query: ({name, type}) => {return {method: "loadDoc", params: {name, type}}},
}),
}),
})
// Export hooks for usage in functional components, which are
// auto-generated based on the defined endpoints
export const { useGetGameInfoQuery, useLoadLevelQuery } = apiSlice
export const { useGetGameInfoQuery, useLoadLevelQuery, useLoadDocQuery } = apiSlice