You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/11/26 15:40:33 UTC

[GitHub] [apisix-dashboard] starsz commented on a change in pull request #868: WIP: fix: delete POST method in /apisix/admin/consumer

starsz commented on a change in pull request #868:
URL: https://github.com/apache/apisix-dashboard/pull/868#discussion_r531108884



##########
File path: api/internal/handler/consumer/consumer.go
##########
@@ -97,35 +95,13 @@ func (h *Handler) List(c droplet.Context) (interface{}, error) {
 	return ret, nil
 }
 
-func (h *Handler) Create(c droplet.Context) (interface{}, error) {
-	input := c.Input().(*entity.Consumer)
-	if input.ID != "" && input.ID != input.Username {
-		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest},
-			fmt.Errorf("consumer's id and username must be a same value")
-	}
-	input.ID = input.Username
-
-	if _, ok := input.Plugins["jwt-auth"]; ok {
-		jwt := input.Plugins["jwt-auth"].(map[string]interface{})
-		jwt["exp"] = 86400
-
-		input.Plugins["jwt-auth"] = jwt
-	}
-
-	if err := h.consumerStore.Create(c.Context(), input); err != nil {
-		return handler.SpecCodeResponse(err), err
-	}
-
-	return nil, nil
-}
-
-type UpdateInput struct {
+type SetInput struct {
 	Username string `auto_read:"username,path"`
 	entity.Consumer

Review comment:
       Good style.Fiexd.




----------------------------------------------------------------
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:
users@infra.apache.org