func (h *Handler) UpdateProfile(c echo.Context) (err error) {
	userID := userIDFromToken(c)
	name := c.FormValue("name")

	db := h.DB.Clone()
	defer db.Close()
	if err = db.DB(config.DbName).C("users").
		UpdateId(bson.ObjectIdHex(userID), bson.M{"$set": bson.M{"name": name}}); err != nil {
		if err == mgo.ErrNotFound {
			return echo.ErrNotFound
		}
	}

	return c.JSON(http.StatusOK, "ok")
}
// UpdateProfile to update profile of the user
UpdateProfile to update profile of the user
// UpdateProfile to update profile of the user
func (h *Handler) UpdateProfile(c echo.Context) (err error) {
	userID := userIDFromToken(c)
	name := c.FormValue("name")
	db := h.DB.Clone()
	defer db.Close()
	if err = db.DB(config.DbName).C("users").
		UpdateId(bson.ObjectIdHex(userID), bson.M{"$set": bson.M{"name": name}}); err != nil {
		if err == mgo.ErrNotFound {
			return echo.ErrNotFound
		}
	}
	return c.JSON(http.StatusOK, "ok")
}
func ( h * Handler ) UpdateProfile ( c echo . Context ) ( err error ) { userID := userIDFromToken ( c ) name := c . FormValue ( " " ) db := h . DB . Clone ( ) defer db . Close ( ) if err = db . DB ( config . DbName ) . C ( " " ) . UpdateId ( bson . ObjectIdHex ( userID ) , bson . M { " " : bson . M { " " : name } } ) ; err != nil { if err == mgo . ErrNotFound { return echo . ErrNotFound } } return c . JSON ( http . StatusOK , " " ) }
UpdateProfile to update profile of the user
UpdateProfile to update profile of the user