mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 01:08:27 +00:00
remove unused action WALLET.ON_BEFORE_UNLOAD
This commit is contained in:
parent
7ed5f11021
commit
c10b8baeba
@ -26,8 +26,6 @@ export type WalletAction = {
|
|||||||
} | {
|
} | {
|
||||||
type: typeof WALLET.TOGGLE_DEVICE_DROPDOWN,
|
type: typeof WALLET.TOGGLE_DEVICE_DROPDOWN,
|
||||||
opened: boolean
|
opened: boolean
|
||||||
} | {
|
|
||||||
type: typeof WALLET.ON_BEFORE_UNLOAD
|
|
||||||
} | {
|
} | {
|
||||||
type: typeof WALLET.ONLINE_STATUS,
|
type: typeof WALLET.ONLINE_STATUS,
|
||||||
online: boolean
|
online: boolean
|
||||||
@ -53,10 +51,6 @@ export const init = (): ThunkAction => (dispatch: Dispatch): void => {
|
|||||||
window.addEventListener('offline', updateOnlineStatus);
|
window.addEventListener('offline', updateOnlineStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onBeforeUnload = (): WalletAction => ({
|
|
||||||
type: WALLET.ON_BEFORE_UNLOAD,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const toggleDeviceDropdown = (opened: boolean): WalletAction => ({
|
export const toggleDeviceDropdown = (opened: boolean): WalletAction => ({
|
||||||
type: WALLET.TOGGLE_DEVICE_DROPDOWN,
|
type: WALLET.TOGGLE_DEVICE_DROPDOWN,
|
||||||
opened,
|
opened,
|
||||||
|
@ -12,7 +12,6 @@ import type { Action, RouterLocationState, TrezorDevice } from 'flowtype';
|
|||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
ready: boolean;
|
ready: boolean;
|
||||||
unloading: boolean;
|
|
||||||
online: boolean;
|
online: boolean;
|
||||||
dropdownOpened: boolean;
|
dropdownOpened: boolean;
|
||||||
initialParams: ?RouterLocationState;
|
initialParams: ?RouterLocationState;
|
||||||
@ -23,7 +22,6 @@ type State = {
|
|||||||
|
|
||||||
const initialState: State = {
|
const initialState: State = {
|
||||||
ready: false,
|
ready: false,
|
||||||
unloading: false,
|
|
||||||
online: navigator.onLine,
|
online: navigator.onLine,
|
||||||
dropdownOpened: false,
|
dropdownOpened: false,
|
||||||
initialParams: null,
|
initialParams: null,
|
||||||
@ -34,12 +32,6 @@ const initialState: State = {
|
|||||||
|
|
||||||
export default function wallet(state: State = initialState, action: Action): State {
|
export default function wallet(state: State = initialState, action: Action): State {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case WALLET.ON_BEFORE_UNLOAD:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
unloading: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
case WALLET.SET_INITIAL_URL:
|
case WALLET.SET_INITIAL_URL:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
@ -16,7 +16,7 @@ import type {
|
|||||||
|
|
||||||
const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch) => (action: Action): Action => {
|
const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch) => (action: Action): Action => {
|
||||||
// make sure that middleware should process this action
|
// make sure that middleware should process this action
|
||||||
if (action.type !== LOCATION_CHANGE || api.getState().wallet.unloading) {
|
if (action.type !== LOCATION_CHANGE) {
|
||||||
// pass action
|
// pass action
|
||||||
return next(action);
|
return next(action);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user