[pricelist][fix] real fix for loading pictures in cordova

This commit is contained in:
Tim Gröger 2021-04-16 17:19:34 +02:00
parent c76da59290
commit e0bf8f77bf
4 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,14 @@
import {computed} from 'vue';
import { LocalStorage } from 'quasar';
const config = { const config = {
baseURL: '/api', baseURL: '/api',
pollingInterval: 30000, pollingInterval: 30000,
}; };
const baseURL = computed(() =>
LocalStorage.getItem<string>('baseURL') || config.baseURL
);
export {baseURL}
export default config; export default config;

View File

@ -156,7 +156,7 @@ import { sort } from '../utils/sort';
import { DeleteObjects } from 'src/plugins/pricelist/utils/utils'; import { DeleteObjects } from 'src/plugins/pricelist/utils/utils';
import { hasPermission } from 'src/utils/permission'; import { hasPermission } from 'src/utils/permission';
import { PERMISSIONS } from 'src/plugins/pricelist/permissions'; import { PERMISSIONS } from 'src/plugins/pricelist/permissions';
import config from 'src/config'; import { baseURL } from 'src/config';
export default defineComponent({ export default defineComponent({
name: 'CalculationTable', name: 'CalculationTable',
@ -477,7 +477,8 @@ export default defineComponent({
function image(uuid: string | undefined) { function image(uuid: string | undefined) {
if (uuid) { if (uuid) {
return `${config.baseURL}/pricelist/picture/${uuid}?size=256`; console.log(baseURL.value)
return `${baseURL.value}/pricelist/picture/${uuid}?size=256`;
} }
return 'no-image.svg'; return 'no-image.svg';
} }

View File

@ -149,7 +149,7 @@ import { Drink, DrinkPriceVolume, usePricelistStore } from '../store';
import DrinkPriceVolumes from './CalculationTable/DrinkPriceVolumes.vue'; import DrinkPriceVolumes from './CalculationTable/DrinkPriceVolumes.vue';
import { clone, calc_min_prices, DeleteObjects, calc_cost_per_volume } from '../utils/utils'; import { clone, calc_min_prices, DeleteObjects, calc_cost_per_volume } from '../utils/utils';
import BuildManual from 'src/plugins/pricelist/components/CalculationTable/BuildManual.vue'; import BuildManual from 'src/plugins/pricelist/components/CalculationTable/BuildManual.vue';
import config from 'src/config'; import { baseURL } from 'src/config';
import { hasPermission } from 'src/utils/permission'; import { hasPermission } from 'src/utils/permission';
import { PERMISSIONS } from 'src/plugins/pricelist/permissions'; import { PERMISSIONS } from 'src/plugins/pricelist/permissions';
@ -273,7 +273,7 @@ export default defineComponent({
return <string>imgsrc.value; return <string>imgsrc.value;
} }
if (edit_drink.value?.uuid) { if (edit_drink.value?.uuid) {
return `${config.baseURL}/pricelist/picture/${edit_drink.value.uuid}?size=256`; return `${baseURL.value}/pricelist/picture/${edit_drink.value.uuid}?size=256`;
} }
return 'no-image.svg'; return 'no-image.svg';
}); });

View File

@ -60,7 +60,7 @@ import BuildManualVolume from '../components/BuildManual/BuildManualVolume.vue';
import SearchInput from '../components/SearchInput.vue'; import SearchInput from '../components/SearchInput.vue';
import { filter, Search } from '../utils/filter'; import { filter, Search } from '../utils/filter';
import { sort } from '../utils/sort'; import { sort } from '../utils/sort';
import config from 'src/config'; import { baseURL } from 'src/config';
export default defineComponent({ export default defineComponent({
name: 'Reciepts', name: 'Reciepts',
components: { BuildManual, BuildManualVolume, SearchInput }, components: { BuildManual, BuildManualVolume, SearchInput },
@ -156,7 +156,7 @@ export default defineComponent({
const search_keys = computed(() => columns_drinks.filter((column) => column.filterable)); const search_keys = computed(() => columns_drinks.filter((column) => column.filterable));
function image(uuid: string | undefined) { function image(uuid: string | undefined) {
if (uuid) { if (uuid) {
return `${config.baseURL}/pricelist/picture/${uuid}?size=256`; return `${baseURL.value}/pricelist/picture/${uuid}?size=256`;
} }
return 'no-image.svg'; return 'no-image.svg';
} }