diff --git a/src/api/v1.ts b/src/api/v1.ts index e52649d..de54450 100644 --- a/src/api/v1.ts +++ b/src/api/v1.ts @@ -1,15 +1,15 @@ -const API_PREFIX = "/api/v1" +const API_PREFIX = '/api/v1' export class RbApi { - async get_json(path) { + async get_json (path) { const url = `${API_PREFIX}${path}` - let res = await fetch(url) + const res = await fetch(url) return await res.json() } - async sections() { - let res = await this.get_json("/sections") + async sections () { + const res = await this.get_json('/sections') - return res["sections"] + return res.sections } } diff --git a/src/components/SectionsList.vue b/src/components/SectionsList.vue index b546a82..f34f5b7 100644 --- a/src/components/SectionsList.vue +++ b/src/components/SectionsList.vue @@ -3,9 +3,9 @@ import { ref } from 'vue' import { RbApi } from '../api/v1' import { Section } from '../models' -let sections = ref([]) +const sections = ref([]) -let api = new RbApi() +const api = new RbApi() await api.sections().then(res => { sections.value = res }) @@ -14,9 +14,9 @@ await api.sections().then(res => {