location
This commit is contained in:
@@ -245,22 +245,30 @@ export class CreatePage {
|
|||||||
this.http
|
this.http
|
||||||
.post(`https://fastcheck.store/api/fastcheck/settings/${encodeURIComponent(id)}`, paidQr)
|
.post(`https://fastcheck.store/api/fastcheck/settings/${encodeURIComponent(id)}`, paidQr)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => this.redirectToSource(),
|
next: () => this.redirectToSource(id),
|
||||||
error: () => this.redirectToSource()
|
error: () => this.redirectToSource(id)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private redirectToSource(): void {
|
private redirectToSource(id?: string): void {
|
||||||
|
const withId = (target: string): string => {
|
||||||
|
if (!id) return target;
|
||||||
|
|
||||||
|
const url = new URL(target, window.location.origin);
|
||||||
|
url.searchParams.set('id', id);
|
||||||
|
return url.toString();
|
||||||
|
};
|
||||||
|
|
||||||
const alias = this.parentAlias.trim().toLowerCase();
|
const alias = this.parentAlias.trim().toLowerCase();
|
||||||
const fromAlias = this.parentRedirects[alias];
|
const fromAlias = this.parentRedirects[alias];
|
||||||
if (fromAlias) {
|
if (fromAlias) {
|
||||||
window.location.href = fromAlias;
|
window.location.href = withId(fromAlias);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const referrer = document.referrer;
|
const referrer = document.referrer;
|
||||||
if (referrer) {
|
if (referrer) {
|
||||||
window.location.href = referrer;
|
window.location.href = withId(referrer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user