split per app
This commit is contained in:
@ -11,10 +11,16 @@ import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import AppView from '../views/AppView.vue';
|
||||
import NotFound from '../views/NotFound.vue';
|
||||
import Home from '../views/Home.vue';
|
||||
|
||||
Vue.use (VueRouter);
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/app/:id',
|
||||
name: 'AppView',
|
||||
|
@ -18,8 +18,8 @@ export default new Vuex.Store ({
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async get_log ({ commit }) {
|
||||
const log = await fetch ('/log')
|
||||
async get_log ({ commit }, { app_id }) {
|
||||
const log = await fetch ('/log', { headers: { app_id } })
|
||||
.then ((res) => res.json ());
|
||||
commit ('set_log', log);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ export default {
|
||||
...Vuex.mapState ({ log: (state) => state.log })
|
||||
},
|
||||
mounted () {
|
||||
this.get_log ();
|
||||
this.get_log ({ app_id: this.$route.params.id });
|
||||
document.body.addEventListener ('keydown', (ev) => {
|
||||
if (ev.key === 's' && ev.ctrlKey) {
|
||||
this.save_config ();
|
||||
|
29
src/views/Home.vue
Normal file
29
src/views/Home.vue
Normal file
@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<ul>
|
||||
<li
|
||||
v-for="(app,key) in apps"
|
||||
:key="key"
|
||||
>
|
||||
<a
|
||||
:href="'/app/' + app.id"
|
||||
v-text="app.name"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return { apps: [] };
|
||||
},
|
||||
async mounted () {
|
||||
this.apps = await fetch ('/app')
|
||||
.then ((res) => res.json ());
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
Reference in New Issue
Block a user