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';
export async function getUrl(route, appName = 'salix') {
let url;
const filter = {
where: { and: [{ appName: appName }, { environment: process.env.NODE_ENV }] },
};
await axios.get('Urls/findOne', { params: { filter } }).then((res) => {
url = res.data.url + route;
});
return url;
const { data } = await axios.get('Urls/findOne', { params: { filter } });
const url = data.url;
return route ? url + route : url;
}

View File

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

View File

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