tokers commented on a change in pull request #1005:
URL: https://github.com/apache/apisix-dashboard/pull/1005#discussion_r540760055



##########
File path: api/internal/handler/ssl/ssl.go
##########
@@ -182,40 +183,29 @@ func (h *Handler) Update(c droplet.Context) (interface{}, 
error) {
        return nil, nil
 }
 
-func (h *Handler) Patch(c droplet.Context) (interface{}, error) {
-       input := c.Input().(*UpdateInput)
-       arr := strings.Split(input.ID, "/")
-       var subPath string
-       if len(arr) > 1 {
-               input.ID = arr[0]
-               subPath = arr[1]
-       }
+func Patch(c *gin.Context) (interface{}, error) {
+       reqBody, _ := c.GetRawData()
+       ID := c.Param("id")
+       subPath := c.Param("path")
 
-       stored, err := h.sslStore.Get(input.ID)
+       sslStore := store.GetStore(store.HubKeySsl)
+       stored, err := sslStore.Get(ID)
        if err != nil {
                return handler.SpecCodeResponse(err), err
        }
 
-       var patch jsonpatch.Patch
-       if subPath != "" {
-               patch = jsonpatch.Patch{
-                       Operations: []jsonpatch.PatchOperation{
-                               {Op: jsonpatch.Replace, Path: subPath, Value: 
c.Input()},
-                       },
-               }
-       } else {
-               patch, err = jsonpatch.MakePatch(stored, input.SSL)
-               if err != nil {
-                       return handler.SpecCodeResponse(err), err
-               }
+       res, err := utils.MergePatch(stored, subPath, reqBody)

Review comment:
       OK




----------------------------------------------------------------
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]


Reply via email to