tweak a bit more

This commit is contained in:
Andre Medeiros 2022-05-07 15:16:04 -04:00
parent ebe7437bfa
commit b55b52bf2c

View file

@ -1,7 +1,6 @@
package api
import (
"context"
"encoding/json"
"fmt"
"net/http"
@ -186,7 +185,6 @@ func (a *api) upsertAccountsHandler(w http.ResponseWriter, r *http.Request) {
_ = a.accountRepo.Disassociate(ctx, &acc, &dev)
}
go func(ctx context.Context, apns string) {
url := fmt.Sprintf("https://apollopushserver.xyz/api/new-server-addition?apns_token=%s", apns)
req, err := http.NewRequestWithContext(ctx, "POST", url, nil)
req.Header.Set("Authorization", "Bearer 98g5j89aurqwfcsp9khlnvgd38fa15")
@ -198,17 +196,14 @@ func (a *api) upsertAccountsHandler(w http.ResponseWriter, r *http.Request) {
return
}
resp, err := a.httpClient.Do(req)
w.WriteHeader(http.StatusOK)
resp, _ := a.httpClient.Do(req)
if err != nil {
a.logger.WithFields(logrus.Fields{
"err": err,
}).Info("failed to remove old client")
a.logger.WithFields(logrus.Fields{"err": err}).Error("failed to remove old client")
return
}
resp.Body.Close()
}(ctx, apns)
w.WriteHeader(http.StatusOK)
}
func (a *api) upsertAccountHandler(w http.ResponseWriter, r *http.Request) {