refs #6067 refactor: getUrl
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-10-03 09:25:28 +02:00
parent 468ed95702
commit 0f1dee42ec
3 changed files with 6 additions and 7 deletions

View File

@ -1,14 +1,11 @@
import axios from 'axios'; import axios from 'axios';
export async function getUrl(route, appName = 'salix') { export async function getUrl(route, appName = 'salix') {
let url;
const filter = { const filter = {
where: { and: [{ appName: appName }, { environment: process.env.NODE_ENV }] }, where: { and: [{ appName: appName }, { environment: process.env.NODE_ENV }] },
}; };
await axios.get('Urls/findOne', { params: { filter } }).then((res) => { const { data } = await axios.get('Urls/findOne', { params: { filter } });
url = res.data.url + route; const url = data.url;
}); return route ? url + route : url;
return url;
} }

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnLogo from 'components/ui/VnLogo.vue'; import VnLogo from 'components/ui/VnLogo.vue';
import { getUrl } from 'src/composables/getUrl';
const route = useRoute(); const route = useRoute();
@ -17,7 +18,7 @@ onMounted(async () => {
color: 'bg-vnColor', color: 'bg-vnColor',
icon: new URL(`../../assets/vn_icon.svg`, import.meta.url).href, icon: new URL(`../../assets/vn_icon.svg`, import.meta.url).href,
text: 'goToShop', text: 'goToShop',
url: params?.url, url: await getUrl(null, 'hedera'),
}); });
if (params?.isWorker && JSON.parse(params?.isWorker)) { if (params?.isWorker && JSON.parse(params?.isWorker)) {

View File

@ -63,6 +63,7 @@ class FormDataMock {
} }
} }
global.FormData = FormDataMock; global.FormData = FormDataMock;
global.URL = class URL {};
export function createWrapper(component, options) { export function createWrapper(component, options) {
const defaultOptions = { const defaultOptions = {