-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INT: added disableMiddleware decorator
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {Type} from '@angular/core'; | ||
import {not, RESTClient, RestMethodMiddlewares, RestMiddleware} from '@anglr/rest'; | ||
|
||
/** | ||
* Allows disabling of specified middleware | ||
* @param middleware - Middleware that will be disabled | ||
*/ | ||
export function DisableMiddleware(middleware: Type<RestMiddleware>) | ||
{ | ||
return function<TDecorated>(_target: RESTClient, _propertyKey: string, descriptor: RestMethodMiddlewares | | ||
TDecorated): TypedPropertyDescriptor<any> | ||
{ | ||
const descr = descriptor as RestMethodMiddlewares; | ||
|
||
descr.middlewareTypes?.push(not(middleware)); | ||
|
||
return descr; | ||
}; | ||
} |
This file contains 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