-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathdelete.go
More file actions
30 lines (23 loc) · 772 Bytes
/
delete.go
File metadata and controls
30 lines (23 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package controller
import (
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/auth"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/guard"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/response"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
)
func Delete(ctx *context.Context) {
param := guard.GetDeleteParam(ctx)
//token := ctx.FormValue("_t")
//
//if !auth.TokenHelper.CheckToken(token) {
// ctx.SetStatusCode(http.StatusBadRequest)
// ctx.WriteString(`{"code":400, "msg":"delete fail"}`)
// return
//}
table.List[param.Prefix].DeleteDataFromDatabase(param.Id)
newToken := auth.TokenHelper.AddToken()
response.OkWithData(ctx, map[string]interface{}{
"token": newToken,
})
}