Skip to content

Commit

Permalink
fix: fix middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
ruiming committed Mar 12, 2018
1 parent c1c9314 commit 62142b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/middlewares/hostInject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function hostInject() {
} else {
ctx.state.hostId = cacheHostId;
}

//
await next();
};
}
3 changes: 2 additions & 1 deletion src/middlewares/sessionInject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BadRequestError } from 'routing-controllers';
*/
export default function sessionInject() {
return async (ctx: Context, next: () => Promise<{}>) => {
const session = await Cache.Instance.get(`TOKEN:${ctx.headers.Authorization}`);
const session = await Cache.Instance.get(`TOKEN:${ctx.headers.authorization}`);

if (!session) {
throw new BadRequestError('Initialize Is Required');
Expand All @@ -19,5 +19,6 @@ export default function sessionInject() {

ctx.state.hostId = hostId;
ctx.state.visiterId = visiterId;
await next();
};
}

0 comments on commit 62142b4

Please sign in to comment.