2019-12-21 23:23:44 +01:00
|
|
|
<template>
|
2020-01-02 00:09:19 +01:00
|
|
|
<div class="modal modal-otp is-active">
|
|
|
|
<div class="modal-background"></div>
|
|
|
|
<div class="modal-content">
|
|
|
|
<section class="section">
|
|
|
|
<div class="columns is-centered">
|
|
|
|
<div class="column is-three-quarters">
|
|
|
|
<div class="box has-background-black-ter ">
|
|
|
|
<form @submit.prevent="updateAccount">
|
2020-01-02 12:57:50 +01:00
|
|
|
<h1 class="subtitle is-2">Edit account</h1>
|
2020-01-02 00:09:19 +01:00
|
|
|
<div class="field">
|
2020-01-02 12:57:50 +01:00
|
|
|
<label class="label">Service</label>
|
2020-01-02 00:09:19 +01:00
|
|
|
<div class="control">
|
|
|
|
<input class="input" type="text" placeholder="Account name" v-model="twofaccount.name" required autofocus />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Email</label>
|
|
|
|
<div class="control">
|
|
|
|
<input class="input" type="email" placeholder="account email" v-model="twofaccount.email" required />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Icon</label>
|
|
|
|
<div class="control">
|
|
|
|
<input class="input" type="text" placeholder="account icon" v-model="twofaccount.icon" required />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
|
|
|
<router-link :to="{ name: 'accounts' }" class="button is-light">Cancel</router-link>
|
|
|
|
</div>
|
|
|
|
<div class="control">
|
2020-01-02 12:57:50 +01:00
|
|
|
<button type="submit" class="button is-link">Save</button>
|
2020-01-02 00:09:19 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
2019-12-21 23:23:44 +01:00
|
|
|
</div>
|
2020-01-02 00:09:19 +01:00
|
|
|
</div>
|
2019-12-21 23:23:44 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
twofaccount: {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created: function(){
|
|
|
|
this.getAccount();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
getAccount: function () {
|
|
|
|
let token = localStorage.getItem('jwt')
|
|
|
|
|
|
|
|
axios.defaults.headers.common['Content-Type'] = 'application/json'
|
|
|
|
axios.defaults.headers.common['Authorization'] = 'Bearer ' + token
|
|
|
|
|
|
|
|
axios.get('/api/twofaccounts/' + this.$route.params.twofaccountId).then(response => {
|
|
|
|
this.twofaccount = response.data
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
updateAccount: function() {
|
|
|
|
let token = localStorage.getItem('jwt')
|
|
|
|
|
|
|
|
axios.defaults.headers.common['Content-Type'] = 'application/json'
|
|
|
|
axios.defaults.headers.common['Authorization'] = 'Bearer ' + token
|
|
|
|
|
|
|
|
axios.put('/api/twofaccounts/' + this.$route.params.twofaccountId, this.twofaccount).then(response => {
|
|
|
|
this.$router.push({name: 'accounts'});
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|