diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-07-14 09:51:37 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-08-28 16:07:31 +0200 |
| commit | fd67444fe038ac97c553493614b357745834bdb7 (patch) | |
| tree | b834d6bc2f370fcfa735d2d43484870d3c87b556 /gui/src/renderer/lib | |
| parent | bab7783eee1ad89ecbe45fc061cea59804400740 (diff) | |
| download | mullvadvpn-fd67444fe038ac97c553493614b357745834bdb7.tar.xz mullvadvpn-fd67444fe038ac97c553493614b357745834bdb7.zip | |
Replace out of time view when adding time
Diffstat (limited to 'gui/src/renderer/lib')
| -rw-r--r-- | gui/src/renderer/lib/history.tsx | 13 | ||||
| -rw-r--r-- | gui/src/renderer/lib/routes.ts | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx index 159e597cce..af851a01d4 100644 --- a/gui/src/renderer/lib/history.tsx +++ b/gui/src/renderer/lib/history.tsx @@ -116,6 +116,19 @@ export default class History { this.notify(nextState?.transition ?? transitions.none); }; + public replaceRoot = ( + replacementLocation: LocationDescriptor, + replacementState?: Partial<LocationState>, + ) => { + const location = this.createLocation(replacementLocation, replacementState); + this.lastAction = 'REPLACE'; + this.entries.splice(0, 1, location); + + if (this.index === 0) { + this.notify(replacementState?.transition ?? transitions.none); + } + }; + public listen(callback: LocationListener) { this.listeners.push(callback); return () => (this.listeners = this.listeners.filter((listener) => listener !== callback)); diff --git a/gui/src/renderer/lib/routes.ts b/gui/src/renderer/lib/routes.ts index 0be9983769..df8193b6d8 100644 --- a/gui/src/renderer/lib/routes.ts +++ b/gui/src/renderer/lib/routes.ts @@ -6,6 +6,7 @@ export enum RoutePath { main = '/main', redeemVoucher = '/main/voucher/redeem', voucherSuccess = '/main/voucher/success/:newExpiry/:secondsAdded', + expired = '/main/expired', timeAdded = '/main/time-added', setupFinished = '/main/setup-finished', settings = '/settings', |
