upgrade dependencies and fix compatibility issues
This commit is contained in:
@@ -24,11 +24,11 @@ export function rateLimit(
|
||||
const windowStart = now - config.windowMs
|
||||
|
||||
// Clean expired entries
|
||||
for (const [key, data] of cache.entries()) {
|
||||
Array.from(cache.entries()).forEach(([key, data]) => {
|
||||
if (data.resetTime < now) {
|
||||
cache.delete(key)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let data = cache.get(identifier)
|
||||
|
||||
|
||||
1486
package-lock.json
generated
1486
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "infohliadka",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
@@ -9,18 +9,18 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "13.2.4",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"sqlite3": "^5.1.6"
|
||||
"next": "14.2.15",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"sqlite3": "^5.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.15.5",
|
||||
"@types/react": "18.2.48",
|
||||
"@types/react-dom": "18.2.18",
|
||||
"@types/node": "20.14.15",
|
||||
"@types/react": "18.3.11",
|
||||
"@types/react-dom": "18.3.1",
|
||||
"@types/sqlite3": "^3.1.11",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-next": "13.2.4",
|
||||
"typescript": "4.9.4"
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-next": "14.2.15",
|
||||
"typescript": "5.6.3"
|
||||
}
|
||||
}
|
||||
@@ -68,9 +68,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
res.status(405).json({ error: "Method not allowed" })
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error('Users API error:', error)
|
||||
if (error.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||
if (error?.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||
res.status(400).json({ error: "User already exists" })
|
||||
} else {
|
||||
res.status(500).json({ error: "Operation failed" })
|
||||
|
||||
Reference in New Issue
Block a user