mirror of
https://github.com/QingWei-Li/notea.git
synced 2024-12-05 17:17:16 +03:00
26 lines
564 B
TypeScript
26 lines
564 B
TypeScript
|
import { api } from 'services/api'
|
||
|
import { useAuth } from 'services/middlewares/auth'
|
||
|
import { useStore } from 'services/middlewares/store'
|
||
|
|
||
|
export default api()
|
||
|
.use(useAuth)
|
||
|
.use(useStore)
|
||
|
.get(async (req, res) => {
|
||
|
res.json(await req.treeStore.trash.get())
|
||
|
})
|
||
|
.post(async (req, res) => {
|
||
|
const { action, data } = req.body
|
||
|
|
||
|
switch (action) {
|
||
|
case 'delete':
|
||
|
// todo 真删除
|
||
|
console.log(data)
|
||
|
break
|
||
|
|
||
|
default:
|
||
|
return res.APIError.NOT_SUPPORTED.throw('action not found')
|
||
|
}
|
||
|
|
||
|
res.end()
|
||
|
})
|