adds default doc

This commit is contained in:
ajaythapliyal
2023-03-01 09:05:16 +05:30
parent 923165957e
commit 2f63bf85b5
5 changed files with 36 additions and 5936 deletions

View File

@@ -12,13 +12,15 @@ export function fetchAnswerApi(
}
const docPath =
selectedDocs.language +
'/' +
namePath +
'/' +
selectedDocs.version +
'/' +
selectedDocs.model;
selectedDocs.name === 'default'
? 'default'
: selectedDocs.language +
'/' +
namePath +
'/' +
selectedDocs.version +
'/' +
selectedDocs.model;
return fetch('https://docsapi.arc53.com/api/answer', {
method: 'POST',

View File

@@ -1,3 +1,4 @@
// not all properties in Doc are going to be present. Make some optional
export type Doc = {
name: string;
language: string;
@@ -52,7 +53,9 @@ export function setLocalRecentDocs(doc: Doc): void {
}
const docPath =
doc.language + '/' + namePath + '/' + doc.version + '/' + doc.model;
doc.name === 'default'
? 'default'
: doc.language + '/' + namePath + '/' + doc.version + '/' + doc.model;
fetch('https://docsapi.arc53.com/api/docs_check', {
method: 'POST',
headers: {

View File

@@ -29,7 +29,7 @@ export const prefSlice = createSlice({
state.selectedDocs = action.payload;
},
setSourceDocs: (state, action) => {
state.sourceDocs = action.payload;
state.sourceDocs?.push(...action.payload);
},
},
});

View File

@@ -13,7 +13,18 @@ const store = configureStore({
preference: {
apiKey: key ?? '',
selectedDocs: doc !== null ? JSON.parse(doc) : null,
sourceDocs: null,
sourceDocs: [
{
language: '',
name: 'default',
version: '',
dat: '',
description: '',
docLink: '',
fullName: '',
model: '1.0',
},
],
},
},
reducer: {