mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
fix types issue
This commit is contained in:
1 parent
807974d727
commit
c4fd92e289
2 files changed
+5
-2
No files matched your search
@@ -1,7 +1,10 @@
|
|||||||
import type { Request, Response, NextFunction } from 'express'
|
import type { Request, Response, NextFunction } from 'express'
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
|
|
||||||
export function asyncHandler(fn: any) {
|
export function asyncHandler(
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
fn: (req: Request, res: Response, next: NextFunction) => Promise<void>
|
||||||
|
) {
|
||||||
return (req: Request, res: Response, next: NextFunction) => {
|
return (req: Request, res: Response, next: NextFunction) => {
|
||||||
fn(req, res, next).catch(next)
|
fn(req, res, next).catch(next)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function hashPassword(password: string): Promise<string> {
|
|||||||
return bcrypt.hash(password, 10)
|
return bcrypt.hash(password, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function genJWT(payload: any): Promise<string> {
|
export function genJWT(payload: { [key: string]: string }): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
jwt.sign(
|
jwt.sign(
|
||||||
payload,
|
payload,
|
||||||
|
|||||||
Reference in new issue
Block a user