fix: create service and edit product image
This commit is contained in:
parent
18c32e3b34
commit
3792c19ce4
3 changed files with 7 additions and 2 deletions
|
|
@ -194,7 +194,7 @@ withDefaults(
|
||||||
class="col rounded q-my-md items-center justify-center flex"
|
class="col rounded q-my-md items-center justify-center flex"
|
||||||
style="background-color: transparent"
|
style="background-color: transparent"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
:src="`${baseUrl}/${data?.type === 'service' ? 'service' : 'product'}/${data?.id}/image`"
|
:src="`${baseUrl}/${data?.type === 'service' ? 'service' : 'product'}/${data?.id}/image?ts=${Date.now()}`"
|
||||||
>
|
>
|
||||||
<template #error>
|
<template #error>
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ const stat = ref<
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL);
|
||||||
|
|
||||||
const inputSearch = ref('');
|
const inputSearch = ref('');
|
||||||
const inputSearchProductAndService = ref('');
|
const inputSearchProductAndService = ref('');
|
||||||
|
|
@ -695,6 +696,9 @@ const prevProduct = ref<ProductCreate>({
|
||||||
|
|
||||||
function assignFormDataProduct(data: ProductList) {
|
function assignFormDataProduct(data: ProductList) {
|
||||||
statusToggle.value = data.status === 'INACTIVE' ? false : true;
|
statusToggle.value = data.status === 'INACTIVE' ? false : true;
|
||||||
|
console.log(data);
|
||||||
|
profileUrl.value = `${baseUrl.value}/product/${data?.id}/image`;
|
||||||
|
profileSubmit.value = true;
|
||||||
|
|
||||||
prevProduct.value = {
|
prevProduct.value = {
|
||||||
productTypeId: data.productTypeId,
|
productTypeId: data.productTypeId,
|
||||||
|
|
@ -783,6 +787,7 @@ async function submitService() {
|
||||||
formDataProductService.value.productTypeId = currentIdType.value;
|
formDataProductService.value.productTypeId = currentIdType.value;
|
||||||
|
|
||||||
if (dialogService.value) {
|
if (dialogService.value) {
|
||||||
|
formDataProductService.value.productTypeId = currentIdType.value;
|
||||||
await createService(formDataProductService.value);
|
await createService(formDataProductService.value);
|
||||||
totalService.value = totalService.value + 1;
|
totalService.value = totalService.value + 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createService(data: ServiceCreate) {
|
async function createService(data: ServiceCreate) {
|
||||||
const { image, status, productTypeId, ...payload } = data;
|
const { image, status, ...payload } = data;
|
||||||
|
|
||||||
const res = await api.post<ServiceCreate & { imageUploadUrl: string }>(
|
const res = await api.post<ServiceCreate & { imageUploadUrl: string }>(
|
||||||
'/service',
|
'/service',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue