diff --git a/src/App.vue b/src/App.vue index 017d1c7..7acb63b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@ diff --git a/src/api/v1.ts b/src/api/v1.ts new file mode 100644 index 0000000..e52649d --- /dev/null +++ b/src/api/v1.ts @@ -0,0 +1,15 @@ +const API_PREFIX = "/api/v1" + +export class RbApi { + async get_json(path) { + const url = `${API_PREFIX}${path}` + let res = await fetch(url) + return await res.json() + } + + async sections() { + let res = await this.get_json("/sections") + + return res["sections"] + } +} diff --git a/src/components/SectionsList.vue b/src/components/SectionsList.vue new file mode 100644 index 0000000..b546a82 --- /dev/null +++ b/src/components/SectionsList.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/mirage/v1.js b/src/mirage/v1.js index 6c8ff77..9d86be4 100644 --- a/src/mirage/v1.js +++ b/src/mirage/v1.js @@ -21,6 +21,7 @@ export function makeServer ({ environment = 'development' } = {}) { routes () { this.namespace = 'api/v1'; + // Offsets & limits don't need to be implemented here, as the data set isn't large enough to require this yet this.get('/sections', (schema) => { return schema.sections.all(); }) diff --git a/src/models.ts b/src/models.ts new file mode 100644 index 0000000..b321e53 --- /dev/null +++ b/src/models.ts @@ -0,0 +1,25 @@ +export interface Section { + id: str, + shortname: str, + description: str, + is_default: bool, + has_titles: bool, + is_private: bool, + is_archived: bool +} + +export interface Post { + id: str, + section_id: str, + is_private: bool, + is_archived: bool +} + +export interface Version { + id: str, + post_id: str, + title: str, + publish_date: Date, + content: str, + is_draft: bool +}