diff --git a/Sources/JWTKeychain/Extensions/Router.swift b/Sources/JWTKeychain/Extensions/Router.swift index 2955ed9..5ebeb44 100644 --- a/Sources/JWTKeychain/Extensions/Router.swift +++ b/Sources/JWTKeychain/Extensions/Router.swift @@ -6,30 +6,31 @@ public extension Router { on container: Container ) throws { let config: JWTKeychainConfig = try container.make() + let controller = config.controller let middlewares: JWTKeychainMiddlewares = try container.make() let access = self.grouped(middlewares.accessMiddlewares) if let registerPath = config.endpoints.register { - self.post(registerPath) { req in config.controller.register(req: req) } + self.post(registerPath) { req in try controller.register(req: req) } } if let loginPath = config.endpoints.login { - self.post(loginPath) { req in config.controller.logIn(req: req) } + self.post(loginPath) { req in try controller.logIn(req: req) } } if let mePath = config.endpoints.me { - access.get(mePath) { req in config.controller.me(req: req) } + access.get(mePath) { req in try controller.me(req: req) } } if let updatePath = config.endpoints.update { - access.patch(updatePath) { req in config.controller.update(req: req) } + access.patch(updatePath) { req in try controller.update(req: req) } } if let refreshMiddlewares = middlewares.refreshMiddlewares, let tokenPath = config.endpoints.token { - self.grouped(refreshMiddlewares).post(tokenPath) { req in config.controller.token(req: req) } + self.grouped(refreshMiddlewares).post(tokenPath) { req in try config.controller.token(req: req) } } } }