1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

user: url split on pathname only

This commit is contained in:
Harvey Tindall 2024-07-13 14:22:05 +01:00 committed by GitHub
parent 6052329c0b
commit 272c38e0c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -266,12 +266,20 @@ class ReferralCard {
get code(): string { return this._code; } get code(): string { return this._code; }
set code(c: string) { set code(c: string) {
this._code = c; this._code = c;
let url = window.location.href;
let pathArray = url.split('/'); let u = new URL(window.location.href);
url = `${pathArray[0]}//${pathArray[2]}/`; let path = u.pathname;
if (url.slice(-1) != "/") { url += "/"; } for (let split of ["account", "my"]) {
url = url + "invite/" + this._code; path = path.split(split)[0];
this._url = url; }
if (path.slice(-1) != "/") { path += "/"; }
path = path + "invite/" + this._code;
u.pathname = path;
u.hash = "";
u.search = "";
this._url = u.toString();
} }
get remaining_uses(): number { return this._remainingUses; } get remaining_uses(): number { return this._remainingUses; }