mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 11:02:24 -05:00
[bugfix] fix 'steal this look' form, uncheck entries after processing (#1454)
This commit is contained in:
parent
4e4da19720
commit
52fbb3e584
4 changed files with 27 additions and 6 deletions
|
|
@ -18,10 +18,11 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const Promise = require("bluebird");
|
||||
const React = require("react");
|
||||
const syncpipe = require("syncpipe");
|
||||
|
||||
module.exports = function useFormSubmit(form, mutationQuery, { changedOnly = true } = {}) {
|
||||
module.exports = function useFormSubmit(form, mutationQuery, { changedOnly = true, onFinish } = {}) {
|
||||
if (!Array.isArray(mutationQuery)) {
|
||||
throw new ("useFormSubmit: mutationQuery was not an Array. Is a valid useMutation RTK Query provided?");
|
||||
}
|
||||
|
|
@ -64,7 +65,13 @@ module.exports = function useFormSubmit(form, mutationQuery, { changedOnly = tru
|
|||
|
||||
mutationData.action = action;
|
||||
|
||||
return runMutation(mutationData);
|
||||
return Promise.try(() => {
|
||||
return runMutation(mutationData);
|
||||
}).then((res) => {
|
||||
if (onFinish) {
|
||||
return onFinish(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
...result,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue