Skip to content

Commit 288ace9

Browse files
committed
Remove ProductModal and its related variables and methods
1 parent 7032cad commit 288ace9

File tree

3 files changed

+2
-186
lines changed

3 files changed

+2
-186
lines changed

backend/src/views/Products/ProductModal.vue

Lines changed: 0 additions & 152 deletions
This file was deleted.

backend/src/views/Products/Products.vue

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,16 @@
77
Add new Product
88
</router-link>
99
</div>
10-
<ProductsTable @clickEdit="editProduct"/>
11-
<ProductModal v-model="showProductModal" :product="productModel" @close="onModalClose"/>
10+
<ProductsTable/>
1211
</template>
1312

1413
<script setup>
15-
import {computed, onMounted, ref} from "vue";
14+
import {computed} from "vue";
1615
import store from "../../store";
17-
import ProductModal from "./ProductModal.vue";
1816
import ProductsTable from "./ProductsTable.vue";
1917
20-
const DEFAULT_PRODUCT = {
21-
id: '',
22-
title: '',
23-
description: '',
24-
image: '',
25-
price: ''
26-
}
27-
2818
const products = computed(() => store.state.products);
2919
30-
const productModel = ref({...DEFAULT_PRODUCT})
31-
const showProductModal = ref(false);
32-
33-
34-
function editProduct(p) {
35-
store.dispatch('getProduct', p.id)
36-
.then(({data}) => {
37-
productModel.value = data
38-
})
39-
}
40-
41-
function onModalClose() {
42-
productModel.value = {...DEFAULT_PRODUCT}
43-
}
4420
</script>
4521

4622
<style scoped>

backend/src/views/Products/ProductsTable.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ import {PRODUCTS_PER_PAGE} from "../../constants";
186186
import TableHeaderCell from "../../components/core/Table/TableHeaderCell.vue";
187187
import {Menu, MenuButton, MenuItem, MenuItems} from "@headlessui/vue";
188188
import {DotsVerticalIcon, PencilIcon, TrashIcon} from '@heroicons/vue/outline'
189-
import ProductModal from "./ProductModal.vue";
190189
191190
const perPage = ref(PRODUCTS_PER_PAGE);
192191
const search = ref('');
@@ -195,9 +194,6 @@ const sortField = ref('updated_at');
195194
const sortDirection = ref('desc')
196195
197196
const product = ref({})
198-
const showProductModal = ref(false);
199-
200-
const emit = defineEmits(['clickEdit'])
201197
202198
onMounted(() => {
203199
getProducts();
@@ -237,10 +233,6 @@ function sortProducts(field) {
237233
getProducts()
238234
}
239235
240-
function showAddNewModal() {
241-
showProductModal.value = true
242-
}
243-
244236
function deleteProduct(product) {
245237
if (!confirm(`Are you sure you want to delete the product?`)) {
246238
return

0 commit comments

Comments
 (0)