sessionID as prop

This commit is contained in:
Jörn-Michael Miehe 2019-05-27 14:34:07 +02:00
parent 348b4b2702
commit 3b2ff65054
6 changed files with 17 additions and 15 deletions

View file

@ -95,7 +95,6 @@
</template> </template>
<script> <script>
import * as Cookies from 'js-cookie'
import axios from '@/plugins/axios' import axios from '@/plugins/axios'
import Card from './Card.vue' import Card from './Card.vue'
@ -106,6 +105,7 @@ export default {
name: 'Deck', name: 'Deck',
props: { props: {
session: String,
deck: Object deck: Object
}, },
@ -120,10 +120,6 @@ export default {
deleting: false deleting: false
}), }),
computed: {
session: () => Cookies.get('session')
},
methods: { methods: {
save_deck(new_deck) { save_deck(new_deck) {
axios axios

View file

@ -1,6 +1,7 @@
<template> <template>
<v-expansion-panel v-model="open"> <v-expansion-panel v-model="open">
<NewDeck <NewDeck
:session="session"
@change=" @change="
open = null open = null
refresh_decks() refresh_decks()
@ -10,6 +11,7 @@
<Deck <Deck
v-for="deck in linked" v-for="deck in linked"
:deck="deck" :deck="deck"
:session="session"
:key="deck.id" :key="deck.id"
@change="refresh_decks" @change="refresh_decks"
/> />
@ -17,7 +19,6 @@
</template> </template>
<script> <script>
import * as Cookies from 'js-cookie'
import axios from '@/plugins/axios' import axios from '@/plugins/axios'
import DeckJS from '@/classes/Deck' import DeckJS from '@/classes/Deck'
@ -32,6 +33,10 @@ export default {
NewDeck NewDeck
}, },
props: {
session: String
},
data: () => ({ data: () => ({
open: null open: null
}), }),
@ -54,8 +59,6 @@ export default {
}, },
computed: { computed: {
session: () => Cookies.get('session'),
linked() { linked() {
let result = [] let result = []

View file

@ -23,7 +23,6 @@
</template> </template>
<script> <script>
import * as Cookies from 'js-cookie'
import axios from '@/plugins/axios' import axios from '@/plugins/axios'
import DeckEditor from './forms/DeckEditor.vue' import DeckEditor from './forms/DeckEditor.vue'
@ -35,8 +34,8 @@ export default {
DeckEditor DeckEditor
}, },
computed: { props: {
session: () => Cookies.get('session') session: String
}, },
methods: { methods: {

View file

@ -38,6 +38,10 @@ export default {
FormDialog FormDialog
}, },
props: {
session: String
},
data: () => ({ data: () => ({
login: '', login: '',
loginRules: [v => !!v || 'Please enter user name'], loginRules: [v => !!v || 'Please enter user name'],
@ -51,7 +55,7 @@ export default {
doLogin() { doLogin() {
axios axios
.post('/user/login', { .post('/user/login', {
session: Cookies.get('session'), session: this.session,
login: this.login, login: this.login,
password: this.password password: this.password
}) })

View file

@ -2,7 +2,7 @@
<v-content> <v-content>
<v-container> <v-container>
<Header> <Header>
<LoginForm /> <LoginForm :session="session" />
<RegisterForm /> <RegisterForm />
</Header> </Header>

View file

@ -7,9 +7,9 @@
<template v-if="user"> <template v-if="user">
<p>user logged in: {{ user.login }}</p> <p>user logged in: {{ user.login }}</p>
<DeckList />
</template> </template>
<DeckList :session="session" />
</v-container> </v-container>
</v-content> </v-content>
</template> </template>