|
|
@ -152,7 +152,8 @@ export const getValidUrl = (action: RouterAction): PayloadAction<string> => (dis
|
|
|
|
const shouldBeLandingPage = getState().devices.length < 1 || !getState().wallet.ready || getState().connect.error !== null;
|
|
|
|
const shouldBeLandingPage = getState().devices.length < 1 || !getState().wallet.ready || getState().connect.error !== null;
|
|
|
|
const landingPageUrl = dispatch(isLandingPageUrl(requestedUrl));
|
|
|
|
const landingPageUrl = dispatch(isLandingPageUrl(requestedUrl));
|
|
|
|
if (shouldBeLandingPage) {
|
|
|
|
if (shouldBeLandingPage) {
|
|
|
|
return !landingPageUrl ? '/' : requestedUrl;
|
|
|
|
const landingPageRoute = dispatch(isLandingPageUrl(requestedUrl, true));
|
|
|
|
|
|
|
|
return !landingPageRoute ? '/' : requestedUrl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Disallow displaying landing page
|
|
|
|
// Disallow displaying landing page
|
|
|
@ -283,11 +284,17 @@ const goto = (url: string): ThunkAction => (dispatch: Dispatch, getState: GetSta
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Check if requested OR current url is landing page
|
|
|
|
* Check if requested OR current url is landing page
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export const isLandingPageUrl = ($url?: string): PayloadAction<boolean> => (dispatch: Dispatch, getState: GetState): boolean => {
|
|
|
|
export const isLandingPageUrl = ($url?: string, checkRoutes: boolean = false): PayloadAction<boolean> => (dispatch: Dispatch, getState: GetState): boolean => {
|
|
|
|
let url: ?string = $url;
|
|
|
|
let url: ?string = $url;
|
|
|
|
if (typeof url !== 'string') {
|
|
|
|
if (typeof url !== 'string') {
|
|
|
|
url = getState().router.location.pathname;
|
|
|
|
url = getState().router.location.pathname;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (checkRoutes) {
|
|
|
|
|
|
|
|
const isLandingRoute = routes.find(r => r.pattern === url && r.name.indexOf('landing') >= 0);
|
|
|
|
|
|
|
|
if (isLandingRoute) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return url === '/';
|
|
|
|
return url === '/';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -334,7 +341,7 @@ export const gotoFirmwareUpdate = (): ThunkAction => (dispatch: Dispatch, getSta
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export const setInitialUrl = (): PayloadAction<boolean> => (dispatch: Dispatch, getState: GetState): boolean => {
|
|
|
|
export const setInitialUrl = (): PayloadAction<boolean> => (dispatch: Dispatch, getState: GetState): boolean => {
|
|
|
|
const { initialPathname } = getState().wallet;
|
|
|
|
const { initialPathname } = getState().wallet;
|
|
|
|
if (typeof initialPathname === 'string' && !dispatch(isLandingPageUrl(initialPathname))) {
|
|
|
|
if (typeof initialPathname === 'string' && !dispatch(isLandingPageUrl(initialPathname, true))) {
|
|
|
|
const valid = dispatch(getValidUrl({
|
|
|
|
const valid = dispatch(getValidUrl({
|
|
|
|
type: LOCATION_CHANGE,
|
|
|
|
type: LOCATION_CHANGE,
|
|
|
|
payload: {
|
|
|
|
payload: {
|
|
|
|