setTags: call endpoints synchronously

environments/review-moderation-ugbdpu/deployments/941
Alex Gleason 2022-09-11 21:59:16 -05:00
rodzic 6f236dd1e6
commit f472e0cca6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 3 dodań i 5 usunięć

Wyświetl plik

@ -422,13 +422,11 @@ const untagUsers = (accountIds: string[], tags: string[]) =>
/** Synchronizes user tags to the backend. */
const setTags = (accountId: string, oldTags: string[], newTags: string[]) =>
(dispatch: AppDispatch) => {
async(dispatch: AppDispatch) => {
const diff = getTagDiff(oldTags, newTags);
return Promise.all([
dispatch(tagUsers([accountId], diff.added)),
dispatch(untagUsers([accountId], diff.removed)),
]);
await dispatch(tagUsers([accountId], diff.added));
await dispatch(untagUsers([accountId], diff.removed));
};
/** Synchronizes badges to the backend. */