nic-chen commented on a change in pull request #1315:
URL: https://github.com/apache/apisix-dashboard/pull/1315#discussion_r569930628
##########
File path: api/internal/handler/route/route.go
##########
@@ -570,30 +557,26 @@ func (h *Handler) Exist(c droplet.Context) (interface{},
error) {
input := c.Input().(*ExistCheckInput)
name := input.Name
exclude := input.Exclude
- routeStore := store.GetStore(store.HubKeyRoute)
- ret, err := routeStore.List(c.Context(), store.ListInput{
- Predicate: nil,
+ ret, err := h.routeStore.List(c.Context(), store.ListInput{
+ Predicate: func(obj interface{}) bool {
+ r := obj.(*entity.Route)
+ if r.Name == name && r.ID != exclude {
+ return true
+ }
+
+ return false
+ },
PageSize: 0,
PageNumber: 0,
})
-
if err != nil {
return nil, err
}
- sort := store.NewSort(nil)
Review comment:
maybe we could remove these functions now ? I’m not sure if it’s used
anywhere else
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]