Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
armintalaie committed Mar 29, 2024
1 parent 8e9ae1b commit 2944f95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/util/middleware/authorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ export class Authorizer implements IMiddleware<IHandlerEvent, object> {
private connection: Kysely<Database>;

public handler = async (event: APIGatewayProxyEvent) => {
return {};
// const auth = event.headers.Authorization;
// if (auth === undefined) {
// throw new UnauthorizedError('Authorization header is missing');
// }
// const user = await this.verifyUserIsLoggedIn(auth);
// return { user: user };
const auth = event.headers.Authorization;
if (auth === undefined) {
throw new UnauthorizedError('Authorization header is missing');
}
const user = await this.verifyUserIsLoggedIn(auth);
return { user: user };
};

verifyUserIsLoggedIn = async (auth: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/wiki/doc/createDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function router(

const docData = JSON.parse(event.body || '');

if (!docData || !docData.title || !docData.content) {
if (!docData || !docData.title || docData.content === undefined) {
throw new Error('Request is missing body or body is invalid');
}

Expand Down

0 comments on commit 2944f95

Please sign in to comment.