diff options
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', |
