2021-10-29 17:12:58 +02:00
|
|
|
<template>
|
|
|
|
<form-wrapper :title="$t('settings.forms.new_token')">
|
|
|
|
<form @submit.prevent="generatePAToken" @keydown="form.onKeydown($event)">
|
|
|
|
<form-field :form="form" fieldName="name" inputType="text" :label="$t('commons.name')" autofocus />
|
2022-09-17 19:31:11 +02:00
|
|
|
<form-buttons
|
|
|
|
:submitId="'btnGenerateToken'"
|
|
|
|
:isBusy="form.isBusy"
|
|
|
|
:caption="$t('commons.generate')"
|
|
|
|
:showCancelButton="true"
|
|
|
|
cancelLandingView="settings.oauth.tokens" />
|
2021-10-29 17:12:58 +02:00
|
|
|
</form>
|
|
|
|
</form-wrapper>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import Form from './../../../components/Form'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: new Form({
|
|
|
|
name: ''
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async generatePAToken() {
|
|
|
|
|
2022-03-24 15:03:45 +01:00
|
|
|
const { data } = await this.form.post('/oauth/personal-access-tokens')
|
2021-10-29 17:12:58 +02:00
|
|
|
|
|
|
|
if( this.form.errors.any() === false ) {
|
2022-07-07 18:04:04 +02:00
|
|
|
this.$router.push({ name: 'settings.oauth.tokens', params: { accessToken: data.accessToken, token_id: data.token.id } });
|
2021-10-29 17:12:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|