mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-24 20:57:43 +00:00
[render skip] notif tester
This commit is contained in:
parent
7582c90468
commit
fd648cad3a
1 changed files with 6 additions and 3 deletions
|
@ -83,13 +83,16 @@ func (a *api) testDeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
client = client.Production()
|
client = client.Production()
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := client.Push(notification); err != nil {
|
res, err := client.Push(notification)
|
||||||
|
if err != nil {
|
||||||
a.logger.Info("failed to send test notification", zap.Error(err))
|
a.logger.Info("failed to send test notification", zap.Error(err))
|
||||||
a.errorResponse(w, r, 500, err)
|
a.errorResponse(w, r, 500, err)
|
||||||
return
|
} else if !res.Sent() {
|
||||||
}
|
a.errorResponse(w, r, 422, fmt.Errorf("errror sending notification: %d: %s", res.StatusCode, res.Reason))
|
||||||
|
} else {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *api) deleteDeviceHandler(w http.ResponseWriter, r *http.Request) {
|
func (a *api) deleteDeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx, cancel := context.WithCancel(r.Context())
|
ctx, cancel := context.WithCancel(r.Context())
|
||||||
|
|
Loading…
Reference in a new issue