Skip to content

Commit 8664d5e

Browse files
committed
add promise all performance
1 parent f01ed0b commit 8664d5e

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

functions/src/https/email.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as path from "path";
66
export const sendEmail = functions.onCall({
77
handler: async (data) => {
88
const content = data.data;
9-
console.log(content);
109

1110
const transporter = nodemailer.createTransport({
1211
host: process.env.SMTP_HOST,

src/shared/views/CooperatorsView.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,19 +307,19 @@ const submit = async () => {
307307
const coops = cooperatorsEdit.value.map((coop) => new Cooperators({...coop, userDocId: coop.userDocId || coop.id}))
308308
test.value.cooperators = [...coops]
309309
310-
try {
311-
await store.dispatch('updateStudy', test.value);
312-
await store.dispatch('getStudy', { id: test.value.id });
313-
} catch (error) {
314-
console.error('Error updating study:', error);
315-
}
316-
317310
const newCooperators = cooperatorsEdit.value.filter(
318311
(guest) => !cooperatorsUpdate.value.some((c) => c.email === guest.email)
319312
);
320313
321-
for (const guest of newCooperators) {
322-
await sendMenssages(guest);
314+
try {
315+
await store.dispatch('updateStudy', test.value);
316+
317+
await Promise.all([
318+
store.dispatch('getStudy', { id: test.value.id }),
319+
...newCooperators.map(guest => sendMenssages(guest))
320+
]);
321+
} catch (error) {
322+
console.error('Error updating study:', error);
323323
}
324324
};
325325

0 commit comments

Comments
 (0)