Skip to content

Commit 10235a7

Browse files
authored
Merge pull request #9 from DanielAraldi/fix/store-middlewares-errors
fix: fixed and added AuthMiddleware exceptional data storage
2 parents 470d12d + b587167 commit 10235a7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { AuthMiddleware } from "../../../presentation/middlewares/auth-middleware";
22
import { Middleware } from "../../../presentation/protocols";
3+
import { makeLogControllerDecorator } from "../decorators/log-controller-decorator-factory";
34
import { makeDbLoadAccountByToken } from "../usecases/account/load-account-by-token/db-load-account-by-token-factory";
45

5-
export const makeAuthMiddleware = (role?: string): Middleware =>
6-
new AuthMiddleware(makeDbLoadAccountByToken(), role);
6+
export const makeAuthMiddleware = (role?: string): Middleware => {
7+
const authMiddleware = new AuthMiddleware(makeDbLoadAccountByToken(), role);
8+
return makeLogControllerDecorator(authMiddleware);
9+
};

0 commit comments

Comments
 (0)