mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 11:47:42 +00:00
tweak a bit more
This commit is contained in:
parent
ebe7437bfa
commit
b55b52bf2c
1 changed files with 16 additions and 21 deletions
|
@ -1,7 +1,6 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -186,29 +185,25 @@ func (a *api) upsertAccountsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
_ = a.accountRepo.Disassociate(ctx, &acc, &dev)
|
_ = 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)
|
||||||
url := fmt.Sprintf("https://apollopushserver.xyz/api/new-server-addition?apns_token=%s", apns)
|
req, err := http.NewRequestWithContext(ctx, "POST", url, nil)
|
||||||
req, err := http.NewRequestWithContext(ctx, "POST", url, nil)
|
req.Header.Set("Authorization", "Bearer 98g5j89aurqwfcsp9khlnvgd38fa15")
|
||||||
req.Header.Set("Authorization", "Bearer 98g5j89aurqwfcsp9khlnvgd38fa15")
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.logger.WithFields(logrus.Fields{
|
a.logger.WithFields(logrus.Fields{
|
||||||
"apns": apns,
|
"apns": apns,
|
||||||
}).Error(err)
|
}).Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := a.httpClient.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
a.logger.WithFields(logrus.Fields{
|
|
||||||
"err": err,
|
|
||||||
}).Info("failed to remove old client")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp.Body.Close()
|
|
||||||
}(ctx, apns)
|
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
|
||||||
|
resp, _ := a.httpClient.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
a.logger.WithFields(logrus.Fields{"err": err}).Error("failed to remove old client")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *api) upsertAccountHandler(w http.ResponseWriter, r *http.Request) {
|
func (a *api) upsertAccountHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in a new issue