chore(api): url changes

This commit is contained in:
2024-04-08 23:40:24 +02:00
parent 31302cc053
commit 9c59c30f12
4 changed files with 16 additions and 1420 deletions
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -3,8 +3,8 @@ import axios from 'axios';
const http = axios.create({ const http = axios.create({
baseURL: baseURL:
import.meta.env.VITE_API_DEV === '1' && import.meta.env.DEV import.meta.env.VITE_API_DEV === '1' && import.meta.env.DEV
? 'http://localhost:5500' ? 'http://localhost:3001'
: 'https://static.spythere.eu', : 'https://spythere.spythere.eu',
}); });
export default http; export default http;
+1 -5
View File
@@ -7,11 +7,7 @@ export default defineComponent({
}, },
getThumbnailURL(vehicleType: string, size: 'small' | 'large') { getThumbnailURL(vehicleType: string, size: 'small' | 'large') {
return `${ return `https://static.spythere.eu/images/${vehicleType}--${size == 'small' ? 300 : 800}px.jpg`;
import.meta.env.VITE_API_DEV === '1'
? 'http://localhost:5500'
: 'https://static.spythere.eu'
}/images/${vehicleType}--${size == 'small' ? 300 : 800}px.jpg`;
}, },
}, },
}); });
+13 -3
View File
@@ -21,8 +21,7 @@ import {
} from './utils/vehicleUtils'; } from './utils/vehicleUtils';
import i18n from './i18n-setup'; import i18n from './i18n-setup';
import http from './http';
import vehiclesData from './data/vehiclesData.json';
export const useStore = defineStore({ export const useStore = defineStore({
id: 'store', id: 'store',
@@ -123,8 +122,19 @@ export const useStore = defineStore({
}, },
actions: { actions: {
async fetchVehiclesAPI() {
try {
const vehiclesData = (await http.get<IVehiclesData>('/vehicles')).data;
this.vehiclesData = vehiclesData;
console.log(vehiclesData);
} catch (error) {
console.error(error);
}
},
async setupAPIData() { async setupAPIData() {
this.vehiclesData = vehiclesData; await this.fetchVehiclesAPI();
this.mergeBackendTranslations(); this.mergeBackendTranslations();
}, },