Fix bug on api

This commit is contained in:
Henrique Dias 2017-08-01 11:19:58 +01:00
parent 535bd9dab5
commit 6e076bd93b
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
2 changed files with 6 additions and 2 deletions

View File

@ -314,7 +314,11 @@ export function newUser (user) {
} }
} }
request.onerror = (error) => reject(error) request.onerror = (error) => reject(error)
request.send(JSON.stringify(user)) request.send(JSON.stringify({
what: 'user',
which: 'new',
data: user
}))
}) })
} }

View File

@ -197,7 +197,7 @@ func usersPostHandler(c *RequestContext, w http.ResponseWriter, r *http.Request)
c.FM.Users[u.Username] = u c.FM.Users[u.Username] = u
// Set the Location header and return. // Set the Location header and return.
w.Header().Set("Location", "/users/"+strconv.Itoa(u.ID)) w.Header().Set("Location", "/settings/users/"+strconv.Itoa(u.ID))
w.WriteHeader(http.StatusCreated) w.WriteHeader(http.StatusCreated)
return 0, nil return 0, nil
} }