mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
posting node updates flow
This commit is contained in:
parent
f71be36520
commit
fbd64dec4c
2 changed files with 14 additions and 1 deletions
|
@ -8,6 +8,7 @@ export const ERRORS = {
|
|||
UNKNOWN_NODE_TYPE: 'Unknown_Node_Type',
|
||||
URL_INVALID: 'Url_Invalid',
|
||||
FILES_AUDIO_REQUIRED: 'Files_Audio_Required',
|
||||
NOT_ENOUGH_RIGHTS: 'Not_Enough_Rights',
|
||||
};
|
||||
|
||||
export const ERROR_LITERAL = {
|
||||
|
@ -20,4 +21,5 @@ export const ERROR_LITERAL = {
|
|||
[ERRORS.UNKNOWN_NODE_TYPE]: 'Неизвестный тип поста',
|
||||
[ERRORS.URL_INVALID]: 'Неизвестный адрес',
|
||||
[ERRORS.FILES_AUDIO_REQUIRED]: 'Нужна хотя бы одна песня',
|
||||
[ERRORS.NOT_ENOUGH_RIGHTS]: 'У вас недостаточно прав',
|
||||
};
|
||||
|
|
|
@ -46,7 +46,18 @@ function* onNodeSave({ node }: ReturnType<typeof nodeSave>) {
|
|||
}
|
||||
|
||||
const nodes = yield select(selectFlowNodes);
|
||||
yield put(flowSetNodes([result, ...nodes]));
|
||||
const updated_flow_nodes = node.id
|
||||
? nodes.map(item => (item.id === result.id ? result : item))
|
||||
: [result, ...nodes];
|
||||
|
||||
yield put(flowSetNodes(updated_flow_nodes));
|
||||
|
||||
const { current } = yield select(selectNode);
|
||||
|
||||
if (node.id && current.id === result.id) {
|
||||
yield put(nodeSetCurrent(result));
|
||||
}
|
||||
|
||||
return yield put(modalSetShown(false));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue