github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/bv/src/pages/inscription/shared.ts (about) 1 import { UrlServerBase } from "@/shared/logic/controller"; 2 3 const basePath = "/inscription"; 4 5 export function parsePreselected() { 6 const chunks = window.location.pathname.split("/"); 7 const preselected = chunks[chunks.length - 1]; 8 if (isNaN(Number(preselected))) { 9 // pas de préselection 10 return ""; 11 } 12 return preselected; 13 } 14 15 /** prend en compte le mode dev et les query params */ 16 export function apiUrl(endpoint: string) { 17 const loc = window.location; 18 const out = UrlServerBase + basePath + endpoint + loc.search + loc.hash; 19 return out; 20 }