Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cannot set headers after sent to client error #48

Merged
merged 3 commits into from
Sep 5, 2022

Conversation

linneamyl
Copy link
Contributor

No description provided.

src/index.js Outdated
@@ -282,7 +282,7 @@ const main = async () => {
const memberGroup = req.body
// iterate through membergroups and user ids
// Mark the task as completed for all the users
for (let userIds of Object.values(memberGroup)) {
const promises = Object.values(memberGroup).map((userIds) => {
Copy link
Collaborator

@MikaKattainen MikaKattainen Sep 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jotta ei tulis kahta const promises niin olisko helpompi tehdä näin:

const promises = Object.values(memberGroup).map((userIds) => userIds.map((user_guid) =>
            Promise.resolve(
              postTaskEntry({
                user_guid,
                created_by: req.user.membernumber,
                task_guid: req.params.task_id,
                completion_status: 'COMPLETED',
              })
            )
          )
        )

Ehkä poistaa myös tarpeen tuolle const iterablePromises = [].concat.apply([], promises)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Joo!

@linneamyl linneamyl merged commit 12becec into master Sep 5, 2022
@linneamyl linneamyl deleted the fix/cannot-set-headers-error branch September 5, 2022 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants