Last active
August 28, 2018 20:50
-
-
Save JozefFlakus/466cdf99e57643c2a699975e0269d90b to your computer and use it in GitHub Desktop.
Marble.js - Example middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const authorize$: Middleware = (req$) => | |
| req$.pipe( | |
| switchMap(req => iif( | |
| () => !isAuthorized(req), | |
| throwError(new HttpError('Unauthorized', HttpStatus.UNAUTHORIZED)), | |
| of(req), | |
| )), | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment