You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/src/js/actions/ModalActions.js

76 lines
1.5 KiB

7 years ago
/* @flow */
'use strict';
import TrezorConnect, { UI, UI_EVENT } from 'trezor-connect';
import * as MODAL from './constants/modal';
6 years ago
import * as CONNECT from './constants/TrezorConnect';
7 years ago
6 years ago
export function onPinSubmit(value: string): any {
TrezorConnect.uiResponse({ type: UI.RECEIVE_PIN, payload: value });
7 years ago
return {
type: MODAL.CLOSE
7 years ago
}
}
6 years ago
export function onPassphraseSubmit(passphrase: string): any {
return async (dispatch, getState): Promise<void> => {
const resp = await TrezorConnect.uiResponse({
6 years ago
type: UI.RECEIVE_PASSPHRASE,
payload: {
6 years ago
value: passphrase,
save: true
}
});
dispatch({
type: MODAL.CLOSE
6 years ago
});
7 years ago
}
}
6 years ago
export const askForRemember = (device: any) => {
7 years ago
return {
6 years ago
type: MODAL.REMEMBER,
device
7 years ago
}
}
6 years ago
export const onRememberDevice = (device: any) => {
7 years ago
return {
6 years ago
type: CONNECT.REMEMBER,
device
7 years ago
}
}
6 years ago
export const onForgetDevice = (device: any) => {
7 years ago
return {
6 years ago
type: CONNECT.FORGET,
device,
7 years ago
}
}
6 years ago
export const onForgetSingleDevice = (device: any) => {
7 years ago
return {
6 years ago
type: CONNECT.FORGET_SINGLE,
device,
7 years ago
}
}
6 years ago
export const onCancel = () => {
7 years ago
return {
type: MODAL.CLOSE
7 years ago
}
}
6 years ago
export const onDuplicateDevice = (device: any): any => {
return (dispatch: any, getState: any): void => {
7 years ago
6 years ago
dispatch( onCancel() );
7 years ago
6 years ago
dispatch({
type: CONNECT.DUPLICATE,
device
});
7 years ago
}
}