aboutsummaryrefslogtreecommitdiff
path: root/modern/src/form
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 23:39:30 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 23:39:30 +0000
commit004367fc1fd389b169821eb2d73266490f409999 (patch)
tree1b7e6f13c03326a957bdb78351853f429156b3ae /modern/src/form
parent1b93de84e2bf6a6532bdb03e1ae75e47061a4dca (diff)
parent702e674ecce7de1a4f4318ef8f30c572264a4560 (diff)
downloadtrackermap-web-004367fc1fd389b169821eb2d73266490f409999.tar.gz
trackermap-web-004367fc1fd389b169821eb2d73266490f409999.tar.bz2
trackermap-web-004367fc1fd389b169821eb2d73266490f409999.zip
Merge remote-tracking branch 'upstream/master' into group-config
Diffstat (limited to 'modern/src/form')
-rw-r--r--modern/src/form/LinkField.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/modern/src/form/LinkField.js b/modern/src/form/LinkField.js
index 26e1471e..81467a1b 100644
--- a/modern/src/form/LinkField.js
+++ b/modern/src/form/LinkField.js
@@ -44,20 +44,22 @@ const LinkField = ({
const onChange = async (event) => {
const oldValue = linked;
const newValue = event.target.value;
- for (const added of newValue.filter((it) => !oldValue.includes(it))) {
- await fetch('/api/permissions', {
+ const results = [];
+ newValue.filter((it) => !oldValue.includes(it)).forEach((added) => {
+ results.push(fetch('/api/permissions', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(createBody(added)),
- });
- }
- for (const removed of oldValue.filter((it) => !newValue.includes(it))) {
- await fetch('/api/permissions', {
+ }));
+ });
+ oldValue.filter((it) => !newValue.includes(it)).forEach((removed) => {
+ results.push(fetch('/api/permissions', {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(createBody(removed)),
- });
- }
+ }));
+ });
+ await Promise.all(results);
setLinked(newValue);
};