feat(account): add basic view of an account"
This commit is contained in:
51
src/components/Account.vue
Normal file
51
src/components/Account.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="account-tab">
|
||||
<b-card no-body>
|
||||
<b-tabs card>
|
||||
<b-tab :title=account.name >
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {BCard, BTabs , BTab} from "bootstrap-vue";
|
||||
import {getAnAccount} from "@/config/noscomptes";
|
||||
export default {
|
||||
name: 'account',
|
||||
data: function () {
|
||||
return {
|
||||
account: {},
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
getAnAccount(loggedUser.oauth_token, loggedUser.nosComptesId, this.$route.params.accountId).then(data => {
|
||||
this.account = data
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
loadAccount() {
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
getAnAccount(loggedUser.oauth_token, loggedUser.nosComptesId, this.$route.params.accountId).then(data => {
|
||||
this.account = data
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
components: {
|
||||
BCard,
|
||||
BTabs,
|
||||
BTab
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<b-card-text>
|
||||
{{account.name}}
|
||||
</b-card-text>
|
||||
<b-button href="#" variant="primary" class="see-account" >Voir</b-button>
|
||||
<b-button :href="'/account/'+account.id" variant="primary" class="see-account" >Voir</b-button>
|
||||
<b-button href="#" variant="danger" v-on:click="validateDeleteAccount(account.id)">Supprimer</b-button>
|
||||
|
||||
</b-card>
|
||||
|
||||
@@ -20,11 +20,12 @@ export default {
|
||||
.signIn()
|
||||
.then(GoogleUser => {
|
||||
return logWithGoogle(GoogleUser.getAuthResponse().id_token).then(data => {
|
||||
console.log( GoogleUser.getBasicProfile())
|
||||
let userInfoMapped = {
|
||||
nosComptesId: data.id,
|
||||
googleId: GoogleUser.wa,
|
||||
firstName: GoogleUser.mt.Re,
|
||||
email: data.email,
|
||||
googleId: GoogleUser.getBasicProfile().getId(),
|
||||
firstName: GoogleUser.getBasicProfile().getGivenName(),
|
||||
email: GoogleUser.getBasicProfile().getEmail(),
|
||||
oauth_token: GoogleUser.getAuthResponse().id_token,
|
||||
}
|
||||
this.$store.commit('setLoginUser', userInfoMapped)
|
||||
|
||||
@@ -25,7 +25,6 @@ var googleAuth = (function () {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function Auth () {
|
||||
if (!(this instanceof Auth))
|
||||
return new Auth()
|
||||
@@ -38,7 +37,9 @@ var googleAuth = (function () {
|
||||
console.warn('isLoaded() will be deprecated. You can use "this.$gAuth.isInit"')
|
||||
return !!this.GoogleAuth
|
||||
}
|
||||
|
||||
this.currentUser = () => {
|
||||
return this.GoogleAuth.currentUser;
|
||||
}
|
||||
this.load = (config, prompt) => {
|
||||
installClient()
|
||||
.then(() => {
|
||||
|
||||
@@ -3,6 +3,8 @@ import Router from 'vue-router'
|
||||
import Home from '@/views/Home'
|
||||
import Login from '@/views/Login'
|
||||
import store from "../store/store";
|
||||
import MesComptes from "@/components/MesComptes";
|
||||
import Account from "@/components/Account"
|
||||
Vue.use(Router)
|
||||
|
||||
let baseRoutes = [
|
||||
@@ -10,17 +12,19 @@ let baseRoutes = [
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
name: 'Home',
|
||||
component: Home,
|
||||
children: [{
|
||||
path: "accounts",
|
||||
component: MesComptes,
|
||||
}, {
|
||||
path: 'account/:accountId',
|
||||
component: Account,
|
||||
}]
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: Login
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
const router = new Router({
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed">
|
||||
<!-- Right aligned nav items -->
|
||||
<b-navbar-nav>
|
||||
<b-nav-item href="#">Mes comptes</b-nav-item>
|
||||
<b-nav-item href="/accounts">Mes comptes</b-nav-item>
|
||||
<b-nav-item href="#">Nos comptes</b-nav-item>
|
||||
</b-navbar-nav>
|
||||
<b-navbar-nav align="end" class="right-element">
|
||||
@@ -20,13 +20,12 @@
|
||||
</b-navbar>
|
||||
</div>
|
||||
<div>
|
||||
<MesComptes></MesComptes>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MesComptes from '@/components/MesComptes'
|
||||
import router from '@/router/router'
|
||||
import {BDropdownItem, BNavbar, BNavbarNav, BNavItem, BNavItemDropdown} from "bootstrap-vue";
|
||||
|
||||
@@ -37,8 +36,7 @@ export default {
|
||||
BNavbarNav,
|
||||
BNavItem,
|
||||
BNavItemDropdown,
|
||||
BDropdownItem,
|
||||
MesComptes
|
||||
BDropdownItem
|
||||
},
|
||||
methods: {
|
||||
signOut() {
|
||||
|
||||
Reference in New Issue
Block a user