Files
nebula.js/commands/serve/web/utils/appLinkManager.js
Ahmad Mirzaei 7001a47232 feat: introducing react router to nebula web (#973)
* feat: nebula web react-router

* chore: `<HubLayout />`
2022-10-26 16:09:51 +02:00

10 lines
514 B
JavaScript

export const getAppLink = ({ navigate, location, targetApp, info }) => {
const { search } = location;
const protocol = info.enigma.secure ? 'wss' : 'ws';
const host = info.enigma.host === 'localhost' ? `${info.enigma.host}:${info.enigma.port}` : info.enigma.host;
const newEngineUrl = `${protocol}://${host}/app/${encodeURIComponent(targetApp)}`;
const modifiedEngineUrl = search.replace(info.engineUrl, newEngineUrl);
navigate(`/dev/${modifiedEngineUrl}`.replace('&shouldFetchAppList=true', ''));
};