satellite/admin: Move declaration before first usage

Move a variable declaration just before where is used for making easy to
follow the implementation when reading it.

Change-Id: I3e93597956352037a63c5496b11576fdd2c600a6
This commit is contained in:
Ivan Fraixedes 2021-10-24 18:35:48 +02:00
parent 3e040767b4
commit df44e8152d
No known key found for this signature in database
GPG Key ID: 042B474597F96DB7

View File

@ -47,10 +47,6 @@ func (server *Server) addAPIKey(w http.ResponseWriter, r *http.Request) {
Name string `json:"name"`
}
var output struct {
APIKey string `json:"apikey"`
}
err = json.Unmarshal(body, &input)
if err != nil {
sendJSONError(w, "failed to unmarshal request",
@ -99,6 +95,10 @@ func (server *Server) addAPIKey(w http.ResponseWriter, r *http.Request) {
return
}
var output struct {
APIKey string `json:"apikey"`
}
output.APIKey = key.Serialize()
data, err := json.Marshal(output)
if err != nil {