diff --git a/front/components/getImage.vue b/front/components/getImage.vue
index 405ee87..3020174 100644
--- a/front/components/getImage.vue
+++ b/front/components/getImage.vue
@@ -1,17 +1,17 @@
diff --git a/front/pages/table/[id].vue b/front/pages/table/[id].vue
index ab77662..69e9d18 100644
--- a/front/pages/table/[id].vue
+++ b/front/pages/table/[id].vue
@@ -73,8 +73,7 @@ const patchItem = async () => {
Сохранить
-
-
+
diff --git a/front/pages/table/index.vue b/front/pages/table/index.vue
index 643b053..c2b3ff1 100644
--- a/front/pages/table/index.vue
+++ b/front/pages/table/index.vue
@@ -81,7 +81,7 @@ const testCallback = (user: any) => {
no text
-
+
no img
diff --git a/front/store/images.ts b/front/store/images.ts
index ebe9fe5..d126ab8 100644
--- a/front/store/images.ts
+++ b/front/store/images.ts
@@ -1,17 +1,18 @@
interface imagesList {
[key: string]: {
status: 'idle' | 'pending' | 'success' | 'error',
+ type: 'tg' | 'aws',
result?: string
}
}
export const useImagesStore = defineStore('images', {
state: () => ({ list: {} as imagesList }),
actions: {
- getImage(name: string) {
+ getImage(name: string, type: 'tg' | 'aws') {
if (!this.list[name]) {
this.list[name] = {
+ type,
status: 'idle',
- // result: 'https://media.istockphoto.com/id/1490517357/photo/scientists-are-researching-and-analyzing-harmful-contaminants-in-the-laboratory.webp?s=170667a&w=0&k=20&c=Fh4t-P_b-a1QxwyBUzUa0AuLp8FLNyLy4hl4HUm82Ao='
}
}
if (!Object.values(this.list).filter(el => el.status == 'pending').length) {
@@ -20,14 +21,20 @@ export const useImagesStore = defineStore('images', {
return this.list[name]
},
async loadOneImage(name: string) {
- const file_url_data = await apiCall(`tgbot/items/get_image/${name}/`)
+ let file_url_data
+ if (this.list[name].type == 'tg') {
+ file_url_data = await apiCall(`tgbot/items/get_image/${name}/`)
+ } else if (this.list[name].type == 'aws') {
+ file_url_data = await apiCall(`tgbot/items/get_image_s3/${name}/`)
+ }
if (file_url_data.length > 0 && file_url_data[0] !== null) {
this.list[name].status = 'success'
this.list[name].result = file_url_data[0]
} else {
this.list[name].status = 'error'
}
+
if (Object.entries(this.list).filter(el => el[1].status == 'idle').length) {
this.loadImages()
}