sutom/ts/lienHelper.ts
2023-05-18 11:14:32 +02:00

20 lines
533 B
TypeScript

export default class LienHelper {
public static extraireInformation(cle: string): string | null {
if (window.location.hash === "" || window.location.hash === "#") return null;
let hashPart = atob(window.location.hash.substring(1)).split("/");
for (let infoPos in hashPart) {
let info = hashPart[infoPos];
if (!info.includes("=")) continue;
let infoPart = info.split("=");
let infoKey = infoPart[0];
if (infoKey !== cle) continue;
return infoPart[1];
}
return null;
}
}