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