mirror of https://github.com/trezor/trezor-wallet
parent
3a783ce38b
commit
012e222c25
@ -0,0 +1,94 @@
|
||||
/* @flow */
|
||||
|
||||
export type Route = {
|
||||
+name: string;
|
||||
+pattern: string;
|
||||
fields: Array<string>;
|
||||
}
|
||||
|
||||
export const routes: Array<Route> = [
|
||||
{
|
||||
name: 'landing-home',
|
||||
pattern: '/',
|
||||
fields: []
|
||||
},
|
||||
{
|
||||
name: 'landing-bridge',
|
||||
pattern: '/bridge',
|
||||
fields: ['bridge']
|
||||
},
|
||||
{
|
||||
name: 'landing-import',
|
||||
pattern: '/import',
|
||||
fields: ['import']
|
||||
},
|
||||
{
|
||||
name: 'wallet-setting',
|
||||
pattern: '/settings',
|
||||
fields: ['settings']
|
||||
},
|
||||
{
|
||||
name: 'wallet-acquire',
|
||||
pattern: '/device/:device/acquire',
|
||||
fields: ['device', 'acquire']
|
||||
},
|
||||
{
|
||||
name: 'wallet-unreadable',
|
||||
pattern: '/device/:device/unreadable',
|
||||
fields: ['device', 'unreadable']
|
||||
},
|
||||
{
|
||||
name: 'wallet-bootloader',
|
||||
pattern: '/device/:device/bootloader',
|
||||
fields: ['device', 'bootloader']
|
||||
},
|
||||
{
|
||||
name: 'wallet-initialize',
|
||||
pattern: '/device/:device/initialize',
|
||||
fields: ['device', 'initialize']
|
||||
},
|
||||
{
|
||||
name: 'wallet-device-settings',
|
||||
pattern: '/device/:device/settings',
|
||||
fields: ['device', 'settings']
|
||||
},
|
||||
{
|
||||
name: 'wallet-dashboard',
|
||||
pattern: '/device/:device',
|
||||
fields: ['device']
|
||||
},
|
||||
{
|
||||
name: 'wallet-account-summary',
|
||||
pattern: '/device/:device/network/:network/account/:account',
|
||||
fields: ['device', 'network', 'account']
|
||||
},
|
||||
{
|
||||
name: 'wallet-account-send',
|
||||
pattern: '/device/:device/network/:network/account/:account/send',
|
||||
fields: ['device', 'network', 'account', 'send']
|
||||
},
|
||||
{
|
||||
name: 'wallet-account-send-override',
|
||||
pattern: '/device/:device/network/:network/account/:account/send/override',
|
||||
fields: ['device', 'network', 'account', 'send']
|
||||
},
|
||||
{
|
||||
name: 'wallet-account-receive',
|
||||
pattern: '/device/:device/network/:network/account/:account/receive',
|
||||
fields: ['device', 'network', 'account', 'receive']
|
||||
},
|
||||
{
|
||||
name: 'wallet-account-signverify',
|
||||
pattern: '/device/:device/network/:network/account/:account/signverify',
|
||||
fields: ['device', 'network', 'account', 'signverify']
|
||||
}
|
||||
];
|
||||
|
||||
export const getPattern = (name: string): string => {
|
||||
const entry = routes.find(r => r.name === name);
|
||||
if (!entry) {
|
||||
console.error(`Route for ${ name } not found`);
|
||||
return '/';
|
||||
}
|
||||
return entry.pattern;
|
||||
}
|
Loading…
Reference in new issue