aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/ducks
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-06-30 01:19:40 +0800
committerDan <danjm.com@gmail.com>2018-07-05 02:39:29 +0800
commit0796fc58e4638df9e448654b199b661cb2a492aa (patch)
tree291e007e368129180cacf0c117fe147de4b5b08b /ui/app/ducks
parente467eda4f720fa89141ded2e709566102402479b (diff)
downloadtangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.tar
tangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.tar.gz
tangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.tar.bz2
tangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.tar.lz
tangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.tar.xz
tangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.tar.zst
tangerine-wallet-browser-0796fc58e4638df9e448654b199b661cb2a492aa.zip
Improve send token error ux.
Diffstat (limited to 'ui/app/ducks')
-rw-r--r--ui/app/ducks/send.duck.js7
-rw-r--r--ui/app/ducks/tests/send-duck.test.js10
2 files changed, 17 insertions, 0 deletions
diff --git a/ui/app/ducks/send.duck.js b/ui/app/ducks/send.duck.js
index 055cc05c1..db01bbaa9 100644
--- a/ui/app/ducks/send.duck.js
+++ b/ui/app/ducks/send.duck.js
@@ -6,6 +6,7 @@ const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN'
const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN'
const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN'
const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS'
+const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE'
// TODO: determine if this approach to initState is consistent with conventional ducks pattern
const initState = {
@@ -42,6 +43,8 @@ export default function reducer ({ send: sendState = initState }, action = {}) {
...action.value,
},
})
+ case RESET_SEND_STATE:
+ return extend({}, initState)
default:
return newState
}
@@ -70,3 +73,7 @@ export function updateSendErrors (errorObject) {
value: errorObject,
}
}
+
+export function resetSendState () {
+ return { type: RESET_SEND_STATE }
+}
diff --git a/ui/app/ducks/tests/send-duck.test.js b/ui/app/ducks/tests/send-duck.test.js
index c06cf55d2..c101132d9 100644
--- a/ui/app/ducks/tests/send-duck.test.js
+++ b/ui/app/ducks/tests/send-duck.test.js
@@ -24,6 +24,7 @@ describe('Send Duck', () => {
const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN'
const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN'
const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS'
+ const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE'
describe('SendReducer()', () => {
it('should initialize state', () => {
@@ -105,6 +106,15 @@ describe('Send Duck', () => {
})
)
})
+
+ it('should return the initial state in response to a RESET_SEND_STATE action', () => {
+ assert.deepEqual(
+ SendReducer(mockState, {
+ type: RESET_SEND_STATE,
+ }),
+ Object.assign({}, initState)
+ )
+ })
})
describe('openFromDropdown', () => {