From aa64be3c24edd8d4fad674aab28ac962db808665 Mon Sep 17 00:00:00 2001 From: echpochmak31 Date: Sun, 14 Jan 2024 20:54:54 +0300 Subject: [PATCH] fix /delete --- auth-server/server.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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