|
|
@ -22,14 +22,12 @@ func CreateFriendRequest(w http.ResponseWriter, r *http.Request) { |
|
|
|
requestBody, err = ioutil.ReadAll(r.Body) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
err = json.Unmarshal(requestBody, &friendRequest) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -38,14 +36,12 @@ func CreateFriendRequest(w http.ResponseWriter, r *http.Request) { |
|
|
|
err = Database.CreateFriendRequest(&friendRequest) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
returnJSON, err = json.MarshalIndent(friendRequest, "", " ") |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -66,14 +62,12 @@ func CreateFriendRequestQrCode(w http.ResponseWriter, r *http.Request) { |
|
|
|
requestBody, err = ioutil.ReadAll(r.Body) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
err = json.Unmarshal(requestBody, &friendRequests) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
@ -85,7 +79,6 @@ func CreateFriendRequestQrCode(w http.ResponseWriter, r *http.Request) { |
|
|
|
err = Database.CreateFriendRequests(&friendRequests) |
|
|
|
if err != nil { |
|
|
|
http.Error(w, "Error", http.StatusInternalServerError) |
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|