fix /delete
This commit is contained in:
parent
b0d9c95f9d
commit
aa64be3c24
1 changed files with 5 additions and 3 deletions
|
@ -124,15 +124,17 @@ func main() {
|
|||
// can access only with valid token (when logged in), deletes client
|
||||
http.HandleFunc("/delete", logic.ValidateToken(func(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.Header.Get("client_id")
|
||||
errorMessage := "Fault during deleting client"
|
||||
|
||||
err := blockchainStorage.Delete(id)
|
||||
if err != nil {
|
||||
msg := "Fault during deleting client with id: " + id
|
||||
slog.Error(msg, err)
|
||||
slog.Error(errorMessage+" (caused by blockchain) with id: "+id, err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte(msg))
|
||||
w.Write([]byte(errorMessage))
|
||||
}
|
||||
|
||||
logic.DeleteInMemoryClient(id)
|
||||
|
||||
}, srv))
|
||||
|
||||
// can access only with valid token (when logged in), deletes client and creates new one with another secret
|
||||
|
|
Loading…
Reference in a new issue