Skip to content

Commit

Permalink
fix: fix reading auth credentials (@HEYGUL)
Browse files Browse the repository at this point in the history
* fix: fix reading auth credentials
  • Loading branch information
HEYGUL authored Nov 9, 2023
1 parent fe73e42 commit 365b0cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ const register = async (server: Hapi.Server, options: ExtendedAdminJSOptions) =>
options: opts,
handler: async (request, h) => {
try {
const loggedInUser = request.auth?.credentials?.[0];
const loggedInUser = Array.isArray(request.auth?.credentials)
? request.auth?.credentials?.[0]
: request.auth?.credentials;
const controller = new route.Controller({ admin }, loggedInUser);
const ret = await controller[route.action](request, h);
const response = h.response(ret);
Expand Down

0 comments on commit 365b0cf

Please sign in to comment.