diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-02-27 10:06:45 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-02-27 10:06:45 +0100 |
| commit | f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1 (patch) | |
| tree | 1be5586f97d23d154a0d245a115af708761174e1 /gui/src/renderer/lib | |
| parent | a0d5aa28ad71e340bfa002c83285235ec74cea68 (diff) | |
| parent | c7a47757e8208ff7b3b809621680aa79abc9f4f3 (diff) | |
| download | mullvadvpn-f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1.tar.xz mullvadvpn-f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1.zip | |
Merge branch 'fix-e2e-tests-failing'
Diffstat (limited to 'gui/src/renderer/lib')
| -rw-r--r-- | gui/src/renderer/lib/history.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/lib/routeHelpers.ts | 24 | ||||
| -rw-r--r-- | gui/src/renderer/lib/routes.ts | 23 |
3 files changed, 26 insertions, 24 deletions
diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx index 68cbbcf482..159e597cce 100644 --- a/gui/src/renderer/lib/history.tsx +++ b/gui/src/renderer/lib/history.tsx @@ -2,7 +2,8 @@ import { Action, History as OriginalHistory, Location, LocationDescriptorObject import { useHistory as useReactRouterHistory } from 'react-router'; import { IHistoryObject, LocationState } from '../../shared/ipc-types'; -import { GeneratedRoutePath, RoutePath } from './routes'; +import { GeneratedRoutePath } from './routeHelpers'; +import { RoutePath } from './routes'; export interface ITransitionSpecification { name: string; diff --git a/gui/src/renderer/lib/routeHelpers.ts b/gui/src/renderer/lib/routeHelpers.ts new file mode 100644 index 0000000000..50c5867768 --- /dev/null +++ b/gui/src/renderer/lib/routeHelpers.ts @@ -0,0 +1,24 @@ +import { generatePath } from 'react-router'; + +import { RoutePath } from './routes'; + +export type GeneratedRoutePath = { routePath: string }; + +export const disableDismissForRoutes = [ + RoutePath.launch, + RoutePath.login, + RoutePath.tooManyDevices, + RoutePath.deviceRevoked, + RoutePath.main, + RoutePath.redeemVoucher, + RoutePath.voucherSuccess, + RoutePath.timeAdded, + RoutePath.setupFinished, +]; + +export function generateRoutePath( + routePath: RoutePath, + parameters: Parameters<typeof generatePath>[1], +): GeneratedRoutePath { + return { routePath: generatePath(routePath, parameters) }; +} diff --git a/gui/src/renderer/lib/routes.ts b/gui/src/renderer/lib/routes.ts index eaefb26c67..a0248d940e 100644 --- a/gui/src/renderer/lib/routes.ts +++ b/gui/src/renderer/lib/routes.ts @@ -1,7 +1,3 @@ -import { generatePath } from 'react-router'; - -export type GeneratedRoutePath = { routePath: string }; - export enum RoutePath { launch = '/', login = '/login', @@ -26,22 +22,3 @@ export enum RoutePath { selectLocation = '/select-location', filter = '/select-location/filter', } - -export const disableDismissForRoutes = [ - RoutePath.launch, - RoutePath.login, - RoutePath.tooManyDevices, - RoutePath.deviceRevoked, - RoutePath.main, - RoutePath.redeemVoucher, - RoutePath.voucherSuccess, - RoutePath.timeAdded, - RoutePath.setupFinished, -]; - -export function generateRoutePath( - routePath: RoutePath, - parameters: Parameters<typeof generatePath>[1], -): GeneratedRoutePath { - return { routePath: generatePath(routePath, parameters) }; -} |
