mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-16 00:27:49 +02:00
Add Groups to vue front-end
This commit is contained in:
50
resources/js/views/groups/Create.vue
Normal file
50
resources/js/views/groups/Create.vue
Normal file
@ -0,0 +1,50 @@
|
||||
<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 />
|
||||
<div class="field is-grouped">
|
||||
<div class="control">
|
||||
<v-button>{{ $t('commons.create') }}</v-button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button type="button" class="button is-text" @click="cancelCreation">{{ $t('commons.cancel') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</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/groups')
|
||||
|
||||
if( this.form.errors.any() === false ) {
|
||||
this.$router.push({name: 'groups', params: { InitialEditMode: false }});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
cancelCreation: function() {
|
||||
|
||||
this.$router.push({name: 'groups', params: { InitialEditMode: false }});
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user