Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80552 views
1
import { Actions } from 'flummox';
2
import { siteUrl } from '../utils/UrlUtils';
3
4
export default class DocActions extends Actions {
5
async getDoc(path) {
6
let response;
7
8
try {
9
const url = siteUrl(`/flummox/data/docs/${path}.json`);
10
response = await fetch(url);
11
return await response.json();
12
} catch (error) {
13
const url = siteUrl(`/flummox/data/docs/${path}/index.json`);
14
response = await fetch(url);
15
return await response.json();
16
}
17
}
18
19
async getAllDocs() {
20
const url = siteUrl('/flummox/data/allDocs.json');
21
const response = await fetch(url);
22
return await response.json();
23
}
24
}
25
26