mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: simplify scratchpad countdown logic (#373)
This commit is contained in:
1 parent
8fc64a0654
commit
cb18ec19fe
3 files changed
+17
-29
No files matched your search
@@ -17,6 +17,7 @@ export default function reducer(state = {
|
||||
isLoading: false,
|
||||
},
|
||||
isPosting: false,
|
||||
waitSec: 0,
|
||||
isWaiting: false,
|
||||
}, action) {
|
||||
switch (action.type) {
|
||||
@@ -68,6 +69,7 @@ export default function reducer(state = {
|
||||
return {
|
||||
...state,
|
||||
isPosting: false,
|
||||
waitSec: 5,
|
||||
isWaiting: true,
|
||||
};
|
||||
}
|
||||
@@ -77,9 +79,17 @@ export default function reducer(state = {
|
||||
return {
|
||||
...state,
|
||||
isPosting: false,
|
||||
waitSec: 5,
|
||||
isWaiting: true,
|
||||
};
|
||||
}
|
||||
case 'SCRATCHPAD_WAITING_TICK': {
|
||||
return {
|
||||
...state,
|
||||
waitSec: state.waitSec - 1,
|
||||
isWaiting: state.waitSec > 1,
|
||||
};
|
||||
}
|
||||
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_PENDING': {
|
||||
return {
|
||||
...state,
|
||||
@@ -108,12 +118,6 @@ export default function reducer(state = {
|
||||
},
|
||||
};
|
||||
}
|
||||
case 'SCRATCHPAD_WAITING_END': {
|
||||
return {
|
||||
...state,
|
||||
isWaiting: false,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user