func (p *politeiawww) handleStartVote(w http.ResponseWriter, r *http.Request) {
	log.Tracef("handleStartVote")

	var sv v1.StartVote
	decoder := json.NewDecoder(r.Body)
	if err := decoder.Decode(&sv); err != nil {
		RespondWithError(w, r, 0, "handleStartVote: unmarshal", v1.UserError{
			ErrorCode: v1.ErrorStatusInvalidInput,
		})
		return
	}

	user, err := p.getSessionUser(r)
	if err != nil {
		RespondWithError(w, r, 0,
			"handleStartVote: getSessionUser %v", err)
		return
	}

	// Sanity
	if !user.Admin {
		RespondWithError(w, r, 0,
			"handleStartVote: admin %v", user.Admin)
		return
	}

	svr, err := p.backend.ProcessStartVote(sv, user)
	if err != nil {
		RespondWithError(w, r, 0,
			"handleStartVote: ProcessStartVote %v", err)
		return
	}

	util.RespondWithJSON(w, http.StatusOK, svr)
}
// handleStartVote handles starting a vote.
handleStartVote handles starting a vote.
// handleStartVote handles starting a vote .
func (p *politeiawww) handleStartVote(w http.ResponseWriter, r *http.Request) {
	log.Tracef("handleStartVote")
	var sv v1.StartVote
	decoder := json.NewDecoder(r.Body)
	if err := decoder.Decode(&sv); err != nil {
		RespondWithError(w, r, 0, "handleStartVote: unmarshal", v1.UserError{
			ErrorCode: v1.ErrorStatusInvalidInput,
		})
		return
	}
	user, err := p.getSessionUser(r)
	if err != nil {
		RespondWithError(w, r, 0,
			"handleStartVote: getSessionUser %v", err)
		return
	}
	if !user.Admin {
		RespondWithError(w, r, 0,
			"handleStartVote: admin %v", user.Admin)
		return
	}
	svr, err := p.backend.ProcessStartVote(sv, user)
	if err != nil {
		RespondWithError(w, r, 0,
			"handleStartVote: ProcessStartVote %v", err)
		return
	}
	util.RespondWithJSON(w, http.StatusOK, svr)
}
func ( p * politeiawww ) handleStartVote ( w http . ResponseWriter , r * http . Request ) { log . Tracef ( " " ) var sv v1 . StartVote decoder := json . NewDecoder ( r . Body ) if err := decoder . Decode ( & sv ) ; err != nil { RespondWithError ( w , r , 0 , " " , v1 . UserError { ErrorCode : v1 . ErrorStatusInvalidInput , } ) return } user , err := p . getSessionUser ( r ) if err != nil { RespondWithError ( w , r , 0 , " " , err ) return } if ! user . Admin { RespondWithError ( w , r , 0 , " " , user . Admin ) return } svr , err := p . backend . ProcessStartVote ( sv , user ) if err != nil { RespondWithError ( w , r , 0 , " " , err ) return } util . RespondWithJSON ( w , http . StatusOK , svr ) }
handleStartVote handles starting a vote.
handleStartVote handles starting a vote .
// Sanity