2FAuth/resources/js/views/groups/Create.vue

44 lines
1.2 KiB
Vue
Raw Normal View History

2020-10-25 23:59:03 +01:00
<template>
<form-wrapper :title="$t('groups.forms.new_group')">
<form @submit.prevent="createGroup" @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="'btnCreateGroup'"
:isBusy="form.isBusy"
:caption="$t('commons.create')"
:showCancelButton="true"
cancelLandingView="groups" />
2020-10-25 23:59:03 +01:00
</form>
</form-wrapper>
</template>
<script>
import Form from './../../components/Form'
export default {
data() {
return {
form: new Form({
name: '',
})
}
},
methods: {
async createGroup() {
await this.form.post('/api/v1/groups')
2020-10-25 23:59:03 +01:00
if( this.form.errors.any() === false ) {
this.$notify({ type: 'is-success', text: this.$t('groups.group_successfully_created') })
2020-11-26 13:09:23 +01:00
this.$router.push({ name: 'groups' });
2020-10-25 23:59:03 +01:00
}
},
},
}
</script>