agraboso / agraboso/redux-api-middleware

[Question] Passing actions to next rather than dispatching

Đang mở
#221 3 bình luận 5 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
JavaScript
Star
1.5k
Fork
190
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Sorry if you've addressed this already, I searched but came up empty.

---

Why is it that rather than dispatching a new action for success/failure, you instead just pass it to `next`? I definitely understand the request one being passed to next but why the other two? It renders previously provided middleware useless for those actions then.

For some context, my use case is that I've got an authentication middleware before `redux-api-middleware`, which intercepts RSAA actions to add an auth header, but I also wanted said middleware to handle the success action in the case of a login request.

I've never run into an issue outside of this use case so it's not a huge deal, I can work around it, but I was just wondering if there was some reason behind this architecture decision, whether it be a best practice or something else?

I've dispatched a lot from custom middleware when handling side-effects but I'm also not maintaining open source middleware being used by a lot of people, so maybe there's considerations you're taking that I've never thought of. Am I doing it wrong? Is there a wrong/right way here?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.