On this page
删除管理员
控制器:app/controller/admin/manager.js
js
async delete(){
const { ctx, app } = this;
const id = ctx.params.id
await app.model.Manager.destroy({
where:{
id
}
})
ctx.toast('删除成功','success')
ctx.redirect(`/admin/manager`);
}
扩展:app/extend/context.js
js
toast(msg,type = 'danger'){
this.cookies.set('toast',JSON.stringify({
msg,type
}),{
maxAge: 1500,
encrypt: true
});
}
路由:app/router.js
js
router.get("/admin/manager/delete/:id", controller.admin.manager.delete);