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>
|
<b-card-text>
|
||||||
{{account.name}}
|
{{account.name}}
|
||||||
</b-card-text>
|
</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-button href="#" variant="danger" v-on:click="validateDeleteAccount(account.id)">Supprimer</b-button>
|
||||||
|
|
||||||
</b-card>
|
</b-card>
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ export default {
|
|||||||
.signIn()
|
.signIn()
|
||||||
.then(GoogleUser => {
|
.then(GoogleUser => {
|
||||||
return logWithGoogle(GoogleUser.getAuthResponse().id_token).then(data => {
|
return logWithGoogle(GoogleUser.getAuthResponse().id_token).then(data => {
|
||||||
|
console.log( GoogleUser.getBasicProfile())
|
||||||
let userInfoMapped = {
|
let userInfoMapped = {
|
||||||
nosComptesId: data.id,
|
nosComptesId: data.id,
|
||||||
googleId: GoogleUser.wa,
|
googleId: GoogleUser.getBasicProfile().getId(),
|
||||||
firstName: GoogleUser.mt.Re,
|
firstName: GoogleUser.getBasicProfile().getGivenName(),
|
||||||
email: data.email,
|
email: GoogleUser.getBasicProfile().getEmail(),
|
||||||
oauth_token: GoogleUser.getAuthResponse().id_token,
|
oauth_token: GoogleUser.getAuthResponse().id_token,
|
||||||
}
|
}
|
||||||
this.$store.commit('setLoginUser', userInfoMapped)
|
this.$store.commit('setLoginUser', userInfoMapped)
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ var googleAuth = (function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function Auth () {
|
function Auth () {
|
||||||
if (!(this instanceof Auth))
|
if (!(this instanceof Auth))
|
||||||
return new Auth()
|
return new Auth()
|
||||||
@@ -38,7 +37,9 @@ var googleAuth = (function () {
|
|||||||
console.warn('isLoaded() will be deprecated. You can use "this.$gAuth.isInit"')
|
console.warn('isLoaded() will be deprecated. You can use "this.$gAuth.isInit"')
|
||||||
return !!this.GoogleAuth
|
return !!this.GoogleAuth
|
||||||
}
|
}
|
||||||
|
this.currentUser = () => {
|
||||||
|
return this.GoogleAuth.currentUser;
|
||||||
|
}
|
||||||
this.load = (config, prompt) => {
|
this.load = (config, prompt) => {
|
||||||
installClient()
|
installClient()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -143,4 +144,4 @@ var googleAuth = (function () {
|
|||||||
Vue.gAuth.load(GoogleAuthConfig, prompt)
|
Vue.gAuth.load(GoogleAuthConfig, prompt)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default installGoogleAuthPlugin
|
export default installGoogleAuthPlugin
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import Router from 'vue-router'
|
|||||||
import Home from '@/views/Home'
|
import Home from '@/views/Home'
|
||||||
import Login from '@/views/Login'
|
import Login from '@/views/Login'
|
||||||
import store from "../store/store";
|
import store from "../store/store";
|
||||||
|
import MesComptes from "@/components/MesComptes";
|
||||||
|
import Account from "@/components/Account"
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
let baseRoutes = [
|
let baseRoutes = [
|
||||||
@@ -10,17 +12,19 @@ let baseRoutes = [
|
|||||||
path: '/',
|
path: '/',
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
component: Home,
|
component: Home,
|
||||||
},
|
children: [{
|
||||||
{
|
path: "accounts",
|
||||||
path: '/home',
|
component: MesComptes,
|
||||||
name: 'Home',
|
}, {
|
||||||
component: Home,
|
path: 'account/:accountId',
|
||||||
|
component: Account,
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
component: Login
|
component: Login
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = new Router({
|
const router = new Router({
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed">
|
<b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed">
|
||||||
<!-- Right aligned nav items -->
|
<!-- Right aligned nav items -->
|
||||||
<b-navbar-nav>
|
<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-nav-item href="#">Nos comptes</b-nav-item>
|
||||||
</b-navbar-nav>
|
</b-navbar-nav>
|
||||||
<b-navbar-nav align="end" class="right-element">
|
<b-navbar-nav align="end" class="right-element">
|
||||||
@@ -20,13 +20,12 @@
|
|||||||
</b-navbar>
|
</b-navbar>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<MesComptes></MesComptes>
|
<router-view></router-view>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MesComptes from '@/components/MesComptes'
|
|
||||||
import router from '@/router/router'
|
import router from '@/router/router'
|
||||||
import {BDropdownItem, BNavbar, BNavbarNav, BNavItem, BNavItemDropdown} from "bootstrap-vue";
|
import {BDropdownItem, BNavbar, BNavbarNav, BNavItem, BNavItemDropdown} from "bootstrap-vue";
|
||||||
|
|
||||||
@@ -37,8 +36,7 @@ export default {
|
|||||||
BNavbarNav,
|
BNavbarNav,
|
||||||
BNavItem,
|
BNavItem,
|
||||||
BNavItemDropdown,
|
BNavItemDropdown,
|
||||||
BDropdownItem,
|
BDropdownItem
|
||||||
MesComptes
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
signOut() {
|
signOut() {
|
||||||
|
|||||||
Reference in New Issue
Block a user