mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-22 15:15:34 +00:00
Switch MIrage to its own folder
This commit is contained in:
29
mirage/index.js
Normal file
29
mirage/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Server } from "miragejs"
|
||||||
|
|
||||||
|
new Server({
|
||||||
|
routes() {
|
||||||
|
this.namespace = 'api';
|
||||||
|
|
||||||
|
this.get('/emails', async () => {
|
||||||
|
return [{
|
||||||
|
id: 1,
|
||||||
|
subject: 'First Steps',
|
||||||
|
body: 'Learning Vue with Vue 3, cool!',
|
||||||
|
read: false,
|
||||||
|
archived: false,
|
||||||
|
}, {
|
||||||
|
id: 2,
|
||||||
|
subject: 'Vue 3 - pretty cool',
|
||||||
|
body: 'Lots of really good features happening here',
|
||||||
|
read: false,
|
||||||
|
archived: false
|
||||||
|
}, {
|
||||||
|
id: 3,
|
||||||
|
subject: 'Do we have a released date?',
|
||||||
|
body: "I hear Q2 2020.",
|
||||||
|
read: true,
|
||||||
|
archived: false
|
||||||
|
}]
|
||||||
|
}, {timing: 2000})
|
||||||
|
}
|
||||||
|
})
|
||||||
31
src/main.js
31
src/main.js
@@ -1,34 +1,5 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
import '../mirage/index';
|
||||||
import { Server } from "miragejs"
|
|
||||||
|
|
||||||
new Server({
|
|
||||||
routes() {
|
|
||||||
this.namespace = 'api';
|
|
||||||
|
|
||||||
this.get('/emails', async () => {
|
|
||||||
return [{
|
|
||||||
id: 1,
|
|
||||||
subject: 'First Steps',
|
|
||||||
body: 'Learning Vue with Vue 3, cool!',
|
|
||||||
read: false,
|
|
||||||
archived: false,
|
|
||||||
}, {
|
|
||||||
id: 2,
|
|
||||||
subject: 'Vue 3 - pretty cool',
|
|
||||||
body: 'Lots of really good features happening here',
|
|
||||||
read: false,
|
|
||||||
archived: false
|
|
||||||
}, {
|
|
||||||
id: 3,
|
|
||||||
subject: 'Do we have a released date?',
|
|
||||||
body: "I hear Q2 2020.",
|
|
||||||
read: true,
|
|
||||||
archived: false
|
|
||||||
}]
|
|
||||||
}, {timing: 2000})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
createApp(App).mount('#app');
|
createApp(App).mount('#app');
|
||||||
|
|||||||
Reference in New Issue
Block a user