Skip to content

Commit

Permalink
chore: temporarily use beta adminjs
Browse files Browse the repository at this point in the history
  • Loading branch information
dziraf committed Mar 21, 2023
1 parent 35a957c commit 69b79bf
Show file tree
Hide file tree
Showing 4 changed files with 1,792 additions and 1,482 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@types/koa__router": "^12.0.0",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"adminjs": "^6.0.0",
"adminjs": "^7.0.0-beta-v7.1",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
Expand All @@ -57,5 +57,8 @@
"koa-mount": "^4.0.0",
"koa-session": "^6.4.0",
"koa-static": "^5.0.0"
},
"resolutions": {
"@types/koa": "^2.13.5"
}
}
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,8 @@
import buildAuthenticatedRouter from './buildAuthenticatedRouter.js'
import buildRouter from './buildRouter.js'

// eslint-disable-next-line @typescript-eslint/no-var-requires
import packageJson from '../package.json' assert { type: 'json' }

const { version } = packageJson

const name = 'AdminJSKoa'
const version = '4'

export type KoaPlugin = {
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const addAdminJsRoutes = (admin: AdminJS, router: Router, app: Application): voi
params,
query: request.query,
payload: {
...(request.body || {}),
...((request as any).body || {}),
...(request.files || {}),
},
}
Expand Down Expand Up @@ -105,7 +105,7 @@ const addAdminJsAuthRoutes = (admin: AdminJS, router: Router, auth: KoaAuthOptio
throw new Error('Invalid state, no session object in context')
}

const { email, password } = ctx.request.body
const { email, password } = (ctx.request as any).body
const adminUser = await auth.authenticate(email, password)
if (adminUser) {
ctx.session.adminUser = adminUser
Expand Down
Loading

0 comments on commit 69b79bf

Please sign in to comment.