fix my account creation

This commit is contained in:
2021-11-11 22:54:17 +01:00
parent 879d5c66e4
commit c090d73aa1
2 changed files with 10 additions and 5 deletions

View File

@@ -26,12 +26,12 @@
</b-tab> </b-tab>
</b-tabs> </b-tabs>
</b-card> </b-card>
<b-modal ref="my-modal" size="lg" centered title=""> <b-modal ref="create-account" size="lg" centered title="">
<template #modal-header="{ }"> <template #modal-header="{ }">
<h5>Ajout d'un compte</h5> <h5>Ajout d'un compte</h5>
</template> </template>
<template #modal-footer="{ ok, cancel }"> <template #modal-footer="{ ok, cancel }">
<b-button size="sm" variant="success" @click="ok()"> <b-button size="sm" variant="success" @click="validateForm()">
Créer Créer
</b-button> </b-button>
<b-button size="sm" variant="danger" @click="cancel()"> <b-button size="sm" variant="danger" @click="cancel()">
@@ -66,7 +66,7 @@
<script> <script>
import {BCard, BTabs, BTab, BCardText, BCardTitle, BIconPlusCircleFill, BModal, BFormGroup, BFormSelect, BFormInput} from "bootstrap-vue"; import {BCard, BTabs, BTab, BCardText, BCardTitle, BIconPlusCircleFill, BModal, BFormGroup, BFormSelect, BFormInput} from "bootstrap-vue";
import {getAccounts} from "@/config/noscomptes"; import {createAccount, getAccounts} from "@/config/noscomptes";
export default { export default {
name: 'mes_comptes', name: 'mes_comptes',
data: function () { data: function () {
@@ -89,8 +89,13 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
validateForm() {
let loggedUser = this.$store.state.loggedUser
createAccount(loggedUser.oauth_token, loggedUser.nosComptesId, {"name": this.name, "provider": this.provider})
.then(this.$refs['create-account'].hide())
},
show() { show() {
this.$refs['my-modal'].show() this.$refs['create-account'].show()
} }
}, },
components: { components: {

View File

@@ -25,7 +25,7 @@ export const createAccount = (oauthToken, userId, account) => {
const headers = { const headers = {
"Authorization": "Bearer " + oauthToken "Authorization": "Bearer " + oauthToken
}; };
return Vue.axios.post("http://localhost:8081/configuration", account, {headers}).then(response => { return Vue.axios.post("http://localhost:8081/users/"+userId+"/accounts", account, {headers}).then(response => {
console.log(response); console.log(response);
return response.data return response.data
}) })