show lemma and tactic docs
This commit is contained in:
+10
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user