Merge pull request #142 from arc53/feature/adds-default

adds default doc
This commit is contained in:
Pavel
2023-03-01 14:52:09 +04:00
committed by GitHub
5 changed files with 44 additions and 5936 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -12,13 +12,16 @@ 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,16 @@ 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: {