location
This commit is contained in:
@@ -245,22 +245,30 @@ export class CreatePage {
|
||||
this.http
|
||||
.post(`https://fastcheck.store/api/fastcheck/settings/${encodeURIComponent(id)}`, paidQr)
|
||||
.subscribe({
|
||||
next: () => this.redirectToSource(),
|
||||
error: () => this.redirectToSource()
|
||||
next: () => this.redirectToSource(id),
|
||||
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 fromAlias = this.parentRedirects[alias];
|
||||
if (fromAlias) {
|
||||
window.location.href = fromAlias;
|
||||
window.location.href = withId(fromAlias);
|
||||
return;
|
||||
}
|
||||
|
||||
const referrer = document.referrer;
|
||||
if (referrer) {
|
||||
window.location.href = referrer;
|
||||
window.location.href = withId(referrer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user