diff --git a/auth-server/server.go b/auth-server/server.go index 457f45f..496926c 100644 --- a/auth-server/server.go +++ b/auth-server/server.go @@ -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