diff --git a/src/api/zeroPrices.js b/src/api/zeroPrices.js
index a7db41a..c69efd1 100644
--- a/src/api/zeroPrices.js
+++ b/src/api/zeroPrices.js
@@ -15,26 +15,13 @@ export const useZeroPrices = () => {
await apiClient.delete('/merch/zeroprices', list)
}
catch (error) {
- console.log('Delete target zero prices error: ', error)
+ console.log('Delete zero prices error: ', error)
throw error
}
}
- const deleteZeroPricesPeriod = async (start, end) => {
- const params = new URLSearchParams({ start, end }).toString()
- const url = `/merch/zeroprices/period${params ? `?${params}` : ''}`
- const response = await apiClient.delete(url)
-
- if (response.status === 200) {
- return response
- } else {
- console.log('Delete period select zero prices error: ', response)
- }
- }
-
return {
getZeroPrices,
deleteZeroPrices,
- deleteZeroPricesPeriod,
}
}
diff --git a/src/components/ChartBlock.vue b/src/components/ChartBlock.vue
index 11bd874..96a5243 100644
--- a/src/components/ChartBlock.vue
+++ b/src/components/ChartBlock.vue
@@ -13,7 +13,6 @@ import {
} from 'chart.js'
import { Line } from 'vue-chartjs'
import 'chartjs-adapter-date-fns'
-import { originColors } from '@/services/colors.js'
ChartJS.register(
Title,
@@ -34,6 +33,11 @@ const props = defineProps({
},
})
+const originColors = {
+ surugaya: '#2d3081',
+ mandarake: '#924646',
+}
+
const chartData = ref({
datasets: [],
})
diff --git a/src/services/apiClient.js b/src/services/apiClient.js
index 639fb84..082f10a 100644
--- a/src/services/apiClient.js
+++ b/src/services/apiClient.js
@@ -7,10 +7,8 @@ let refreshPromise = null
function createConfig(options = {}) {
const token = localStorage.getItem('accessToken');
- const isFormData = options.body instanceof FormData;
-
const headers = {
- ...(isFormData ? {} : { 'Content-Type': 'application/json' }),
+ 'Content-Type': 'application/json',
...options.headers,
};
diff --git a/src/services/colors.js b/src/services/colors.js
deleted file mode 100644
index c337f2a..0000000
--- a/src/services/colors.js
+++ /dev/null
@@ -1,4 +0,0 @@
-export const originColors = {
- surugaya: '#2d3081',
- mandarake: '#924646',
-};
diff --git a/src/views/DetailsView/DetailsViewImages.vue b/src/views/DetailsView/DetailsViewImages.vue
index dc7a258..7284760 100644
--- a/src/views/DetailsView/DetailsViewImages.vue
+++ b/src/views/DetailsView/DetailsViewImages.vue
@@ -54,21 +54,37 @@ function onFileInputChange(event) {
event.target.value = ''
}
-async function fetchImage(bustCache = false) {
+async function handleUpload({ fileList: newFileList }) {
+ const file = newFileList[newFileList.length - 1]
try {
- let imgUrl = getImageUrl(props.merchUuid, 'full')
+ await uploadImage(props.merchUuid, file.file)
- if (bustCache) {
- const separator = imgUrl.includes('?') ? '&' : '?'
- imgUrl += `${separator}_t=${Date.now()}`
- }
+ const { imgUrl } = await getImageUrl(props.merchUuid, 'full')
+
+ message.success('Image uploaded successfully.')
+
+ fileList.value = [
+ {
+ name: file.name,
+ url: imgUrl,
+ status: 'finished',
+ },
+ ]
+ } catch (error) {
+ message.error('Upload error: ' + (error.message || 'Unknown error.'))
+ }
+}
+
+onMounted(async () => {
+ try {
+ const imgUrl = getImageUrl(props.merchUuid, 'full');
await new Promise((resolve, reject) => {
- const img = new Image()
- img.src = imgUrl
- img.onload = () => resolve(imgUrl)
- img.onerror = () => reject(new Error('Image not found'))
- })
+ const img = new Image();
+ img.src = imgUrl;
+ img.onload = () => resolve(imgUrl);
+ img.onerror = () => reject(new Error('Image not found'));
+ });
fileList.value = [
{
@@ -76,28 +92,13 @@ async function fetchImage(bustCache = false) {
url: imgUrl,
status: 'finished',
},
- ]
+ ];
} catch (error) {
- fileList.value = []
+ fileList.value = [];
if (!error.message.includes('404')) {
- console.error('Error getting image:', error)
+ console.error('Error getting image: ', error);
}
}
-}
-
-async function handleUpload({ fileList: newFileList }) {
- const file = newFileList[newFileList.length - 1]
- try {
- await uploadImage(props.merchUuid, file.file)
- message.success('Image uploaded successfully.')
- await fetchImage(true)
- } catch (error) {
- message.error('Upload error: ' + (error.message || 'Unknown error.'))
- }
-}
-
-onMounted(async () => {
- await fetchImage(false)
});
const showConfirmDelete = ref(false)
diff --git a/src/views/ZeroPricesView.vue b/src/views/ZeroPricesView.vue
index 82d41a5..adab776 100644
--- a/src/views/ZeroPricesView.vue
+++ b/src/views/ZeroPricesView.vue
@@ -1,20 +1,54 @@
-
-
-
-
-
-
-
-
-
+
+ Zero prices
+ No data
+
+
-
+
diff --git a/src/views/ZeroPricesView/PeriodSelectTab.vue b/src/views/ZeroPricesView/PeriodSelectTab.vue
deleted file mode 100644
index 4239f15..0000000
--- a/src/views/ZeroPricesView/PeriodSelectTab.vue
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
- Delete
-
-
-
-
diff --git a/src/views/ZeroPricesView/TargetZeroesTab.vue b/src/views/ZeroPricesView/TargetZeroesTab.vue
deleted file mode 100644
index ba71ba5..0000000
--- a/src/views/ZeroPricesView/TargetZeroesTab.vue
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
- Zero prices
- No data
-
-
-
-
-
diff --git a/src/views/ZeroPricesView/ZeroPriceCard.vue b/src/views/ZeroPricesView/ZeroPriceCard.vue
index 32bd31f..10c80d7 100644
--- a/src/views/ZeroPricesView/ZeroPriceCard.vue
+++ b/src/views/ZeroPricesView/ZeroPriceCard.vue
@@ -1,49 +1,36 @@
-
+
Delete
Name: {{ props.zeroPrice.name }}
Created: {{ props.zeroPrice.created_at }}
- Origin:
-
- {{ props.zeroPrice.origin }}
-
-
+ Origin: {{ props.zeroPrice.origin }}
@@ -61,11 +48,4 @@ const currentOriginColor = computed(() => {
gap: 12px;
border: 1px solid #e0e0e0;
}
-
-.bordered {
- border: 1px solid;
- border-radius: 4px;
- padding: 2px;
- margin: 3px;
-}
diff --git a/src/views/ZeroPricesView/ZeroPricesToolbar.vue b/src/views/ZeroPricesView/ZeroPricesToolbar.vue
index abe01cb..122e3d5 100644
--- a/src/views/ZeroPricesView/ZeroPricesToolbar.vue
+++ b/src/views/ZeroPricesView/ZeroPricesToolbar.vue
@@ -10,7 +10,7 @@ const props = defineProps({
const messages = useMessage()
const { deleteZeroPrices } = useZeroPrices()
-const emit = defineEmits(['deleted', 'selectAll'])
+const emit = defineEmits(['deleted'])
const handleDelete = async () => {
try {
@@ -22,11 +22,6 @@ const handleDelete = async () => {
messages.error("Error deleting selected prices")
}
}
-
-const handleSelectAll = async () => {
- emit('selectAll')
-}
-
@@ -37,9 +32,6 @@ const handleSelectAll = async () => {
{{ props.selected.length }} items selected
-
- Click here to select all
-