Skip to content

Commit

Permalink
manual update remote url
Browse files Browse the repository at this point in the history
  • Loading branch information
Ицкович Алексей Анатольевич committed Mar 9, 2024
1 parent a12b400 commit 53dc35f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*ngFor="let link of links"
mat-tab-link
[style.flex-grow]="'unset'"
queryParamsHandling="preserve"
[routerLink]="link.path"
(click)="activeLink = link.path"
[active]="activeLink === link.path"
Expand Down
14 changes: 12 additions & 2 deletions apps/configurator/src/app/services/store/server-sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable, OnDestroy } from '@angular/core';
import { filter, first, interval, map, of, startWith, Subject, switchMap, takeUntil, tap } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { LocalStorageService } from './local-storage.service';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { BoardConfig } from '@configurator/shared';
import { Location } from '@angular/common';

Expand All @@ -23,7 +23,17 @@ export class ServerSyncService implements OnDestroy {
private readonly router: Router,
private readonly activatedRoute: ActivatedRoute,
private readonly location: Location,
) { }
) {
this.router.events.pipe(
filter(event => event instanceof NavigationEnd),
takeUntil(this.destroy$),
).subscribe(() => {
const remoteUrl = this.localStorageService.get<BoardConfig>(this.currentKey)?.remoteUrl;
const query = this.router.createUrlTree([], {relativeTo: this.activatedRoute, queryParams: {url: remoteUrl}}).toString();

this.location.go(query);
})
}

public init(callback: (config: BoardConfig) => void): void {
this.activatedRoute.queryParams
Expand Down

0 comments on commit 53dc35f

Please sign in to comment.