Commit 9462c892 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

Merge branch 'feature/UI-vuetify' into 'feature/category-ui'

# Conflicts:
#   layouts/admin.vue
#   pages/categories/index.vue
#   pages/posts/index.vue
#   pages/products/index.vue
#   pages/users/index.vue
parents 8a977e31 064aae00
......@@ -5,19 +5,284 @@
<!-- eslint-disable vue/require-v-for-key -->
<template>
<div>
<b-breadcrumb>
<b-breadcrumb-item href="/home">
<b-icon icon="house-fill" scale="1.25" shift-v="1.25" aria-hidden="true" />
Home
</b-breadcrumb-item>
<b-breadcrumb-item href="/posts">
Post
</b-breadcrumb-item>
</b-breadcrumb>
<div>
<v-breadcrumbs :items="items">
<template #divider>
<v-icon>mdi-chevron-right</v-icon>
</template>
</v-breadcrumbs>
</div>
<div style="float: right">
<b-button v-b-modal.modal-create class="text-white">
New Post
</b-button>
<v-dialog
v-model="dialog1"
persistent
max-width="600px"
enctype="multipart/form-data"
>
<template #activator="{ on, attrs }">
<v-btn
color="primary"
dark
v-bind="attrs"
v-on="on"
>
New Post
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="text-h5">CREAT POST</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="title"
label="Title*"
required
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="category_id"
:items="categories"
item-text="name"
item-value="id"
label="Category"
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="content"
label="Content"
required
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="status"
:items="statusDefaul"
item-text="name"
item-value="id"
label="Status"
/>
</v-col>
<v-col cols="12">
<v-file-input
v-model="images"
label="File input"
small-chips
dense
accept="image/*"
@change="fileSelected"
/>
</v-col>
</v-row>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="dialog1 = false"
>
Close
</v-btn>
<v-btn
color="blue darken-1"
text
type="submit"
@click="dialog1 = false; createPost()"
>
Save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
<!-- modal-show -->
<v-dialog
v-model="dialog2"
persistent
max-width="600px"
>
<v-card>
<v-card-title>
<span class="text-h5">POST</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="sTitle"
label="Title"
disabled
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="sCategoryId"
:items="categories"
item-text="name"
item-value="id"
label="Category"
disabled
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="sContent"
label="Content"
disabled
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="sStatus"
:items="statusDefaul"
item-text="name"
item-value="id"
label="Category"
disabled
/>
</v-col>
<v-col cols="12">
<v-col v-for="(image, index) in sImages" :key="index" cols="12">
<v-img :src="image" contain />
</v-col>
</v-col>
</v-row>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="dialog2 = false"
>
Close
</v-btn>
<v-btn
color="blue darken-1"
text
type="submit"
@click="dialog2 = false;"
>
Save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- modal-edit -->
<v-dialog
v-model="dialog"
persistent
max-width="600px"
>
<v-card>
<v-card-title>
<span class="text-h5">EDIT POST</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="eTitle"
label="Title*"
required
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="eCategoryId"
:items="categories"
item-text="name"
item-value="id"
label="Category"
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="eContent"
label="Content"
required
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="eStatus"
:items="statusDefaul"
item-text="name"
item-value="id"
label="Category"
/>
</v-col>
<v-col cols="12">
<v-file-input
v-model="eImages"
label="File input"
accept="image/*"
small-chips
dense
/>
</v-col>
</v-row>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="dialog = false"
>
Close
</v-btn>
<v-btn
color="blue darken-1"
text
type="submit"
@click="dialog = false; updatePost()"
>
Save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- <div style="float: right">
<b-button class="text-white" v-b-modal.modal-create>New Post</b-button>
</div>
<b-modal id="modal-create" title="create Post" class="modal fade">
<div class="w-full mt-4 p-10">
......@@ -78,9 +343,9 @@
Submit
</button>
</template>
</b-modal>
</b-modal> -->
<!-- modal-show -->
<b-modal id="modal-show" title="POST" class="modal fade">
<!-- <b-modal id="modal-show" title="POST" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label>Title :</label>
......@@ -111,9 +376,9 @@
Close
</button>
</template>
</b-modal>
</b-modal> -->
<!-- modal-edit -->
<b-modal id="modal-edit" title="Edit Post " class="modal fade">
<!-- <b-modal id="modal-edit" title="Edit Post " class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label>Title :</label>
......@@ -164,7 +429,7 @@
Submit
</button>
</template>
</b-modal>
</b-modal> -->
<!-- table -->
<div>
<v-data-table :headers="headers" :items="posts" sort-by="calories" class="elevation-1">
......@@ -175,7 +440,7 @@
<v-spacer />
</v-toolbar>
</template>
<template #item.actions="{ item }">
<template #[`item.actions`]="{ item }">
<v-icon :id="item.id" small @click="editPost(item)">
mdi-pencil
</v-icon>
......@@ -204,6 +469,9 @@ export default {
middleware: ['web'],
data: () => {
return {
file: null,
dialog1: false,
dialog2: false,
title: '',
category_id: null,
content: '',
......@@ -212,11 +480,6 @@ export default {
images: [],
dialog: false,
dialogDelete: false,
options: [
{ value: 1, text: 'Draft' },
{ value: 2, text: 'Publish' },
{ value: 3, text: 'UnPublish' }
],
headers: [
{
text: 'Title',
......@@ -230,6 +493,33 @@ export default {
{ text: 'status', value: 'status' },
{ text: 'Actions', value: 'actions', sortable: false }
],
items: [
{
icon: 'mdi-home',
text: 'Home',
disabled: false,
href: '/home'
},
{
text: 'Product',
disabled: false,
href: '/products'
}
],
statusDefaul: [
{
name: 'Draft',
id: '1'
},
{
name: 'Publish',
id: '2'
},
{
name: 'UnPublish',
id: '3'
}
],
posts: [],
categories: [],
sTitle: '',
......@@ -240,11 +530,11 @@ export default {
sImages: null,
eId: '',
eTitle: '',
eCategoryId: '',
eCategoryId: [],
eContent: '',
eUserId: '',
eStatus: '',
eImages: null,
eImages: [],
message: [],
editedIndex: -1,
editedItem: {
......@@ -361,25 +651,23 @@ export default {
},
createPost () {
const self = this
const fd = new FormData()
fd.append('title', this.title)
fd.append('category_id', this.category_id)
fd.append('content', this.content)
fd.append('images', this.images)
fd.append('status', this.status)
this.$axios
.post('/posts/',
{
title: this.title,
category_id: this.category_id,
content: this.content,
images: this.images,
user_id: this.user_id,
status: this.status
},
fd,
{
headers: {
'Content-Type': 'multipart/form-data',
'Content-Type': 'multipart/form-data; application/json',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
}
}
)
.then((response) => {
this.$bvModal.hide('modal-create')
self.$toast.success('Post created successfully!', {
duration: 3000
})
......@@ -388,9 +676,6 @@ export default {
this.posts.push(this.editedItem)
})
.catch((errors) => {
this.$bvModal.hide('modal-create')
console.log(errors.response.data.message)
this.message = errors.response.data.message
self.$toast.error('something went wrong while trying create!', {
duration: 3000
})
......@@ -435,61 +720,62 @@ export default {
this.sTitle = resp.data.data.title
this.sContent = resp.data.data.content
this.sCategoryId = resp.data.data.category_id
this.sUserId = resp.data.data.user_id
this.sStatus = resp.data.data.status
this.sImages = resp.data.data.images
} catch (error) {
console.log(error)
}
this.$bvModal.show('modal-show')
this.dialog2 = true
},
editPost (item) {
this.$bvModal.show('modal-edit')
this.eId = item.id
this.eTitle = item.title
this.eCategoryId = item.category_id
this.eContent = item.content
this.eStatus = item.status
this.eUserId = item.user_id
this.editedIndex = this.posts.indexOf(item)
console.log(this.editedIndex)
this.dialog = true
},
updatePost () {
const self = this
const fd = new FormData()
fd.append('title', this.eTitle)
fd.append('category_id', this.eCategoryId)
fd.append('content', this.eContent)
fd.append('images', this.eImages)
fd.append('status', this.eStatus)
const currentPostIndex = this.editedIndex
this.$axios
.post(
`/posts/update/${this?.eId}`,
{
title: this.eTitle,
category_id: this.eCategoryId,
content: this.eContent,
images: this.eImages,
user_id: this.eUserId,
status: this.eStatus
},
fd,
{
headers: {
'Content-Type': 'multipart/form-data',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`,
Accept: 'application/json, text/plain, */*'
}
}
)
.then((response) => {
this.$bvModal.hide('modal-edit')
self.$toast.success('Post updated successfully!', {
duration: 3000
})
console.log(response)
this.editedItem = response.data.data
this.$bvModal.hide('modal-edit')
Object.assign(this.posts[this.editedIndex], this.editedItem)
Object.assign(this.posts[currentPostIndex], this.editedItem)
})
.catch((error) => {
console.log(error)
this.$bvModal.hide('modal-edit')
self.$toast.error('something went wrong while trying create!', {
duration: 3000
})
})
},
fileSelected (event) {
console.log(event)
console.log(this.images)
}
}
}
......
......@@ -2,21 +2,422 @@
<!-- eslint-disable vue/valid-v-slot -->
<template>
<div>
<b-breadcrumb>
<b-breadcrumb-item href="/home">
<b-icon icon="house-fill" scale="1.25" shift-v="1.25" aria-hidden="true" />
Home
</b-breadcrumb-item>
<b-breadcrumb-item href="/products">
Product
</b-breadcrumb-item>
</b-breadcrumb>
<div>
<v-breadcrumbs :items="items">
<template #divider>
<v-icon>mdi-chevron-right</v-icon>
</template>
</v-breadcrumbs>
</div>
<div style="float: right">
<b-button v-b-modal.modal-create class="text-white">
New Product
</b-button>
<v-dialog
v-model="dialog1"
persistent
max-width="600px"
>
<template #activator="{ on, attrs }">
<v-btn
color="primary"
dark
v-bind="attrs"
v-on="on"
>
New Product
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="text-h5">CREAT PRODUCT</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="name"
label="Name*"
required
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="category_id"
:items="categories"
item-text="name"
item-value="id"
label="Category"
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="price"
label="Price*"
required
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="description"
label="Description"
/>
</v-col>
<v-col cols="12">
<v-file-input
v-model="images"
label="File input"
small-chips
dense
accept="image/*"
multiple
/>
</v-col>
<v-col cols="12">
<v-btn
class="mx-2"
fab
dark
small
color="indigo"
@click="addMore()"
>
<v-icon dark>
mdi-plus
</v-icon>
</v-btn>
</v-col>
<v-row v-for="(variant, index) in variants" :key=" 'B' +index">
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.color"
label="Color*"
required
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.size"
label="Size*"
required
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.quantity"
label="Quantity*"
required
/>
</v-col>
<v-col>
<v-btn
v-show="index != 0"
class=""
fab
dark
x-small
color="red"
@click="remove(index)"
>
<v-icon dark>
mdi-minus
</v-icon>
</v-btn>
</v-col>
</v-row>
</v-row>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="dialog1 = false; seeVariant()"
>
Close
</v-btn>
<v-btn
color="blue darken-1"
text
type="submit"
@click="dialog1 = false; createProduct();"
>
Save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
<b-modal id="modal-create" title="create Product" class="modal fade">
<!-- show-modal -->
<v-dialog
v-model="dialog2"
persistent
max-width="600px"
>
<v-card>
<v-card-title>
<span class="text-h5">PRODUCT</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="sName"
label="Name"
disabled
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="sCategoryId"
:items="categories"
item-text="name"
item-value="id"
label="Category"
disabled
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="sPrice"
label="Price"
disabled
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="sDescription"
label="Description"
/>
</v-col>
<v-col v-for="(image, index) in sImages" :key="index" cols="12">
<v-img :src="image" contain />
</v-col>
<v-col cols="12" />
<v-row v-for="(variant, index) in sVariants" :key="'A' +index">
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.color"
label="Color"
disabled
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.size"
label="Size"
disabled
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.quantity"
label="Quantity"
disabled
/>
</v-col>
<v-col />
</v-row>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="blue darken-1"
text
type="submit"
@click="dialog2 = false"
>
Close
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- edit-modal -->
<v-dialog
v-model="dialog3"
persistent
max-width="600px"
>
<v-card>
<v-card-title>
<span class="text-h5">EDIT PRODUCT</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="eName"
label="Name*"
required
/>
</v-col>
<v-col
cols="12"
>
<v-select
v-model="eCategoryId"
:items="categories"
item-text="name"
item-value="id"
label="Category"
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="ePrice"
label="Price*"
required
/>
</v-col>
<v-col cols="12">
<v-text-field
v-model="eDescription"
label="Description"
/>
</v-col>
<v-col cols="12">
<v-file-input
v-model="eImages"
label="File input"
small-chips
dense
multiple
/>
</v-col>
<v-col cols="12">
<v-btn
class="mx-2"
fab
dark
small
color="indigo"
@click="addMoreVariant()"
>
<v-icon dark>
mdi-plus
</v-icon>
</v-btn>
</v-col>
<v-row v-for="(variant, index) in eVariants" :key=" 'B' +index">
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.color"
label="Color*"
required
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.size"
label="Size*"
required
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="variant.quantity"
label="Quantity*"
required
/>
</v-col>
<v-col>
<v-btn
v-show="index != 0"
class=""
fab
dark
x-small
color="red"
@click="removeVariant(index)"
>
<v-icon dark>
mdi-minus
</v-icon>
</v-btn>
</v-col>
</v-row>
</v-row>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="dialog3 = false"
>
Close
</v-btn>
<v-btn
color="blue darken-1"
text
type="submit"
@click="dialog3 = false; updateProduct();"
>
Save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- <b-modal id="modal-create" title="create Product" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label for="input-live">Name :</label>
......@@ -120,9 +521,9 @@
Submit
</button>
</template>
</b-modal>
</b-modal> -->
<!-- modal-show -->
<b-modal id="modal-show" title="PRODUCT" class="modal fade">
<!-- <b-modal id="modal-show" title="PRODUCT" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label>Name :</label>
......@@ -201,9 +602,9 @@
Close
</button>
</template>
</b-modal>
</b-modal> -->
<!-- modal-edit -->
<b-modal id="modal-edit" title="Edit Product" class="modal fade">
<!-- <b-modal id="modal-edit" title="Edit Product" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label>Name :</label>
......@@ -302,7 +703,7 @@
Submit
</button>
</template>
</b-modal>
</b-modal> -->
<!-- table -->
<div>
<v-data-table
......@@ -318,7 +719,7 @@
<v-spacer />
</v-toolbar>
</template>
<template #item.actions="{ item }">
<template #[`item.actions`]="{ item }">
<v-icon :id="item.id" small @click="editProduct(item)">
mdi-pencil
</v-icon>
......@@ -341,7 +742,6 @@
<script>
export default {
name: 'App',
layout: 'admin',
middleware: ['web'],
data: () => {
......@@ -360,7 +760,12 @@ export default {
quantity: ''
}
],
dialog: false,
color: '',
size: '',
quantity: '',
dialog1: false,
dialog2: false,
dialog3: false,
dialogDelete: false,
options: [],
headers: [
......@@ -377,6 +782,20 @@ export default {
{ text: 'stock', value: 'stock' },
{ text: 'Actions', value: 'actions', sortable: false }
],
items: [
{
icon: 'mdi-home',
text: 'Home',
disabled: false,
href: '/home'
},
{
text: 'Product',
disabled: false,
href: '/products'
}
],
i: '',
products: [],
product: [],
categories: [],
......@@ -449,6 +868,7 @@ export default {
},
methods: {
initialize () {
this.images = []
this.products = []
this.product = []
this.categories = []
......@@ -531,24 +951,31 @@ export default {
},
createProduct () {
const self = this
// const set = new Set([this.images])
// const images = Array.from(set)
const fd = new FormData()
fd.append('name', this.name)
fd.append('price', this.price)
fd.append('category_id', this.category_id)
fd.append('description', this.description)
for (let i = 0; i < this.variants.length; i++) {
fd.append(`variants[${i}][color]`, this.variants[i].color)
fd.append(`variants[${i}][quantity]`, this.variants[i].quantity)
fd.append(`variants[${i}][size]`, this.variants[i].size)
}
for (let j = 0; j < this.images.length; j++) {
fd.append(`images[${j}]`, this.images[j])
}
this.$axios
.post('/products/', {
name: this.name,
price: this.price,
category_id: this.category_id,
description: this.description,
images: this.images,
variants: this.variants
}, {
headers: {
'Content-Type': 'multipart/form-data',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
}
})
.post('/products/',
fd
,
{
headers: {
'Content-Type': 'application/json; multipart/form-data ',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`,
Accept: 'application/json; multipart/form-data'
}
})
.then((response) => {
this.$bvModal.hide('modal-create')
self.$toast.success('Product created successfully!', {
duration: 3000
})
......@@ -557,7 +984,6 @@ export default {
this.products.push(this.editedItem)
})
.catch((errors) => {
this.$bvModal.hide('modal-create')
console.log(errors.response.data.message)
this.message = errors.response.data.message
self.$toast.error('something went wrong while trying create!', {
......@@ -608,10 +1034,9 @@ export default {
} catch (error) {
console.log(error)
}
this.$bvModal.show('modal-show')
this.dialog2 = true
},
editProduct (item) {
this.$bvModal.show('modal-edit')
this.eId = item.id
this.eName = item.name
this.eCategoryId = item.category_id
......@@ -620,24 +1045,35 @@ export default {
this.eDescription = item.description
this.eVariants = item.variants
this.editedIndex = this.products.indexOf(item)
console.log(item.variants)
this.dialog3 = true
},
updateProduct (ID) {
const self = this
const fd = new FormData()
fd.append('name', this.eName)
fd.append('price', this.ePrice)
fd.append('category_id', this.eCategoryId)
fd.append('description', this.eDescription)
for (let i = 0; i < this.eVariants.length; i++) {
fd.append(`variants[${i}][id]`, this.eVariants[i].id)
fd.append(`variants[${i}][color]`, this.eVariants[i].color)
fd.append(`variants[${i}][quantity]`, this.eVariants[i].quantity)
fd.append(`variants[${i}][size]`, this.eVariants[i].size)
}
for (let j = 0; j < this.eImages.length; j++) {
fd.append(`images[${j}]`, this.eImages[j])
}
const currentPostIndex = this.editedIndex
try {
this.$axios
.post(`/products/update/${this?.eId}`, {
name: this.eName,
price: this.ePrice,
category_id: this.eCategoryId,
description: this.eDescription,
images: this.eImages,
variants: this.eVariants
}, {
headers: {
'Content-Type': 'multipart/form-data',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
.post(`/products/update/${this?.eId}`,
fd, {
headers: {
'Content-Type': 'multipart/form-data',
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
}
}
}
)
.then((response) => {
self.$toast.success('User updated successfully!', {
......@@ -645,8 +1081,7 @@ export default {
})
console.log(response)
this.editedItem = response.data.data
this.$bvModal.hide('modal-edit')
Object.assign(this.products[this.editedIndex], this.editedItem)
Object.assign(this.products[currentPostIndex], this.editedItem)
})
} catch (error) {
console.log(error)
......@@ -671,6 +1106,9 @@ export default {
},
removeVariant (index) {
this.eVariants.splice(index, 1)
},
seeVariant () {
console.log(this.variants)
}
}
}
......
......@@ -2,6 +2,7 @@
<template>
<v-app>
<div>
<div />
<div>
<v-breadcrumbs :items="items">
<template #divider>
......@@ -10,12 +11,7 @@
</v-breadcrumbs>
</div>
<div style="float: right">
<v-dialog
v-model="dialog1"
persistent
max-width="600px"
@submit.prevent="createUser"
>
<v-dialog v-model="dialog1" persistent max-width="600px" @submit.prevent="createUser">
<template #activator="{ on, attrs }">
<v-btn
color="primary"
......@@ -155,8 +151,7 @@
<v-spacer />
</v-toolbar>
</template>
// eslint-disable-next-line vue/valid-v-slot
<template #item.actions="{ item }">
<template #[`item.actions`]="{ item }">
<v-icon :id="item.id" small class="mr-2" @click="dialog2 = true; editUser(item);">
mdi-pencil
</v-icon>
......
export default function ({ $axios }, inject, redirect) {
$axios.onError(error => {
if(error.response.status === 500) {
$axios.onError((error) => {
if (error.response.status === 500) {
redirect('/500')
}
})
$axios.onError(error => {
$axios.onError((error) => {
const code = parseInt(error.response && error.response.status)
if (code === 400) {
redirect('/400')
......@@ -22,4 +22,4 @@ export default function ({ $axios }, inject, redirect) {
// Inject to context as $api
inject('api', api)
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment