2019-02-22 19:23:42 +00:00
|
|
|
<template>
|
2019-05-07 16:09:45 +00:00
|
|
|
<v-container>
|
2019-05-08 19:34:50 +00:00
|
|
|
<Header />
|
|
|
|
|
|
2019-05-09 12:31:54 +00:00
|
|
|
<p>user logged in: {{ user.login }}</p>
|
2019-05-10 12:09:49 +00:00
|
|
|
|
2019-05-13 15:35:32 +00:00
|
|
|
<v-expansion-panel>
|
|
|
|
|
<v-expansion-panel-content v-for="deck in decks" :key="deck.id">
|
|
|
|
|
<template v-slot:header>
|
|
|
|
|
<div>{{ deck.content.name }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
<v-card>
|
|
|
|
|
<v-card-text>
|
|
|
|
|
{{ deck.content.note }}
|
|
|
|
|
<ul>
|
|
|
|
|
<li v-for="card in deck.content.cards" :key="card.serial">
|
|
|
|
|
{{ card.serial }}: {{ cardsdb[card.serial].name }}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</v-card-text>
|
|
|
|
|
</v-card>
|
|
|
|
|
</v-expansion-panel-content>
|
|
|
|
|
</v-expansion-panel>
|
2019-05-10 12:09:49 +00:00
|
|
|
|
2019-05-07 20:15:18 +00:00
|
|
|
<v-btn @click.native="logout">Logout</v-btn>
|
2019-05-07 16:09:45 +00:00
|
|
|
</v-container>
|
2019-02-22 19:23:42 +00:00
|
|
|
</template>
|
2019-02-23 01:40:15 +00:00
|
|
|
|
|
|
|
|
<script>
|
2019-05-07 16:09:45 +00:00
|
|
|
import * as Cookies from 'js-cookie'
|
|
|
|
|
import axios from '@/plugins/axios'
|
2019-05-13 15:35:32 +00:00
|
|
|
import CardsDB from '@/plugins/ffdecks'
|
2019-05-07 16:09:45 +00:00
|
|
|
|
2019-05-08 19:34:50 +00:00
|
|
|
import Header from '@/components/Header.vue'
|
|
|
|
|
|
2019-02-23 01:40:15 +00:00
|
|
|
export default {
|
2019-05-09 12:20:03 +00:00
|
|
|
name: 'UserCP',
|
2019-05-07 16:09:45 +00:00
|
|
|
|
2019-05-08 19:34:50 +00:00
|
|
|
components: {
|
|
|
|
|
Header
|
|
|
|
|
},
|
|
|
|
|
|
2019-05-07 16:09:45 +00:00
|
|
|
data: () => ({
|
2019-05-10 12:09:49 +00:00
|
|
|
user: '',
|
2019-05-13 15:35:32 +00:00
|
|
|
decks: '',
|
|
|
|
|
cardsdb: null
|
2019-05-07 16:09:45 +00:00
|
|
|
}),
|
|
|
|
|
|
2019-05-07 20:15:18 +00:00
|
|
|
methods: {
|
2019-05-07 20:28:51 +00:00
|
|
|
goHome() {
|
|
|
|
|
Cookies.remove('session')
|
|
|
|
|
this.$router.push({ name: 'home' })
|
|
|
|
|
},
|
|
|
|
|
|
2019-05-07 20:15:18 +00:00
|
|
|
logout() {
|
|
|
|
|
axios
|
|
|
|
|
.post('/user/logout', {
|
|
|
|
|
session: Cookies.get('session')
|
|
|
|
|
})
|
|
|
|
|
.then(response => {
|
|
|
|
|
if (response.data.success) {
|
2019-05-07 20:28:51 +00:00
|
|
|
this.goHome()
|
2019-05-07 20:15:18 +00:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-05-07 16:09:45 +00:00
|
|
|
mounted() {
|
2019-05-13 15:35:32 +00:00
|
|
|
this.cardsdb = CardsDB
|
|
|
|
|
|
2019-05-07 16:09:45 +00:00
|
|
|
axios
|
2019-05-09 12:31:54 +00:00
|
|
|
.post('/user/info', {
|
2019-05-07 16:09:45 +00:00
|
|
|
session: Cookies.get('session')
|
|
|
|
|
})
|
|
|
|
|
.then(response => {
|
2019-05-07 20:28:51 +00:00
|
|
|
if (response.data.success) {
|
2019-05-09 12:31:54 +00:00
|
|
|
this.user = response.data.user
|
2019-05-07 20:28:51 +00:00
|
|
|
} else {
|
|
|
|
|
this.goHome()
|
|
|
|
|
}
|
2019-05-07 16:09:45 +00:00
|
|
|
})
|
2019-05-10 12:09:49 +00:00
|
|
|
axios
|
|
|
|
|
.post('/decks/list', {
|
|
|
|
|
session: Cookies.get('session')
|
|
|
|
|
})
|
|
|
|
|
.then(response => {
|
|
|
|
|
if (response.data.success) {
|
2019-05-13 15:35:15 +00:00
|
|
|
this.decks = response.data.decks
|
2019-05-10 12:09:49 +00:00
|
|
|
}
|
|
|
|
|
})
|
2019-02-23 01:40:15 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|