diff options
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) }; -} |
