mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-04 06:57:20 +01:00
move store in local storage
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { promises } from 'fs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
|
||||
import { remove as storeRemove } from '../../../lib/store'
|
||||
import { getPdfPath } from '../../../lib/utils'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
@@ -24,22 +23,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
res.status(404).json({ statusCode: 404, message: 'Method Not Allowed' })
|
||||
}
|
||||
break
|
||||
case 'DELETE':
|
||||
try {
|
||||
const {
|
||||
query: { id: idArg },
|
||||
} = req
|
||||
|
||||
storeRemove(idArg)
|
||||
|
||||
res.status(202).end()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
res.status(404).json({ statusCode: 404, message: 'Method Not Allowed' })
|
||||
}
|
||||
break
|
||||
default:
|
||||
res.setHeader('Allow', ['GET', 'DELETE'])
|
||||
res.setHeader('Allow', ['GET'])
|
||||
res.status(405).end(`Method ${method} Not Allowed`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user