Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
Jef Roosens | c1a68ff66c | |
Renovate Bot | 902c8a3884 | |
Jef Roosens | 2bcfeaae83 | |
Jef Roosens | abe6a938de | |
Jef Roosens | 63d9810f42 | |
Jef Roosens | 40d491284e | |
Jef Roosens | a1b35747af | |
Jef Roosens | 83ba3764c6 | |
Jef Roosens | 1f52afdfe2 |
|
@ -0,0 +1,19 @@
|
||||||
|
pipeline:
|
||||||
|
install:
|
||||||
|
image: 'node:17.3.0'
|
||||||
|
commands:
|
||||||
|
- yarn install
|
||||||
|
|
||||||
|
# This step makes sure the project properly builds.
|
||||||
|
build:
|
||||||
|
image: 'node:17.3.0'
|
||||||
|
group: test
|
||||||
|
commands:
|
||||||
|
- yarn run build
|
||||||
|
|
||||||
|
lint:
|
||||||
|
image: 'node:17.3.0'
|
||||||
|
group: test
|
||||||
|
commands:
|
||||||
|
- yarn run lint
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
const API_PREFIX = "/api/v1"
|
const API_PREFIX = '/api/v1'
|
||||||
|
|
||||||
export class RbApi {
|
export class RbApi {
|
||||||
async get_json (path) {
|
async get_json (path) {
|
||||||
const url = `${API_PREFIX}${path}`
|
const url = `${API_PREFIX}${path}`
|
||||||
let res = await fetch(url)
|
const res = await fetch(url)
|
||||||
return await res.json()
|
return await res.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
async sections () {
|
async sections () {
|
||||||
let res = await this.get_json("/sections")
|
const res = await this.get_json('/sections')
|
||||||
|
|
||||||
return res["sections"]
|
return res.sections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { ref } from 'vue'
|
||||||
import { RbApi } from '../api/v1'
|
import { RbApi } from '../api/v1'
|
||||||
import { Section } from '../models'
|
import { Section } from '../models'
|
||||||
|
|
||||||
let sections = ref([])
|
const sections = ref([])
|
||||||
|
|
||||||
let api = new RbApi()
|
const api = new RbApi()
|
||||||
await api.sections().then(res => {
|
await api.sections().then(res => {
|
||||||
sections.value = res
|
sections.value = res
|
||||||
})
|
})
|
||||||
|
@ -16,7 +16,7 @@ await api.sections().then(res => {
|
||||||
<div>
|
<div>
|
||||||
<p>yeet</p>
|
<p>yeet</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for='section in sections'>
|
<li v-for="section in sections">
|
||||||
{{ section }}
|
{{ section }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -29,21 +29,21 @@ export const sections = [
|
||||||
is_private: false,
|
is_private: false,
|
||||||
is_archived: false
|
is_archived: false
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
|
|
||||||
export const posts = [
|
export const posts = [
|
||||||
{
|
{
|
||||||
id: 'af08bbcd-f6eb-446e-b355-13e0a0ef008e',
|
id: 'af08bbcd-f6eb-446e-b355-13e0a0ef008e',
|
||||||
section_id: sections[0]['id'],
|
section_id: sections[0].id,
|
||||||
is_private: false,
|
is_private: false,
|
||||||
is_archived: false
|
is_archived: false
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
|
|
||||||
export const versions = [
|
export const versions = [
|
||||||
{
|
{
|
||||||
id: '8c5bc2f9-e52f-4e19-bd76-119cc42ff863',
|
id: '8c5bc2f9-e52f-4e19-bd76-119cc42ff863',
|
||||||
post_id: posts[0]['id'],
|
post_id: posts[0].id,
|
||||||
title: 'This Is A Title',
|
title: 'This Is A Title',
|
||||||
publish_date: '2021-12-28',
|
publish_date: '2021-12-28',
|
||||||
content: 'Hello. This is some content!',
|
content: 'Hello. This is some content!',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createServer, Model } from 'miragejs';
|
import { createServer, Model } from 'miragejs'
|
||||||
import { sections, posts, versions } from './models';
|
import { sections, posts, versions } from './models'
|
||||||
|
|
||||||
export function makeServer ({ environment = 'development' } = {}) {
|
export function makeServer ({ environment = 'development' } = {}) {
|
||||||
const server = createServer({
|
const server = createServer({
|
||||||
|
@ -12,27 +12,26 @@ export function makeServer ({ environment = 'development' } = {}) {
|
||||||
},
|
},
|
||||||
|
|
||||||
seeds (server) {
|
seeds (server) {
|
||||||
sections.forEach(s => server.create('section', s));
|
sections.forEach(s => server.create('section', s))
|
||||||
posts.forEach(s => server.create('post', s));
|
posts.forEach(s => server.create('post', s))
|
||||||
versions.forEach(s => server.create('version', s));
|
versions.forEach(s => server.create('version', s))
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
routes () {
|
routes () {
|
||||||
this.namespace = 'api/v1';
|
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
|
// 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) => {
|
this.get('/sections', (schema) => {
|
||||||
return schema.sections.all();
|
return schema.sections.all()
|
||||||
})
|
})
|
||||||
this.get('/posts', (schema) => {
|
this.get('/posts', (schema) => {
|
||||||
return schema.posts.all();
|
return schema.posts.all()
|
||||||
})
|
})
|
||||||
this.get('/versions', (schema) => {
|
this.get('/versions', (schema) => {
|
||||||
return schema.versions.all();
|
return schema.versions.all()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
return server;
|
return server
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue