making notifications optional

This commit is contained in:
Roland Osborne 2022-11-15 09:10:01 -08:00
parent 45e002a97c
commit 53f947d675
2 changed files with 4 additions and 4 deletions

View File

@ -26,8 +26,7 @@ func AddAccountApp(w http.ResponseWriter, r *http.Request) {
// parse requested notifications // parse requested notifications
var notifications []Notification var notifications []Notification
if err := ParseRequest(r, w, &notifications); err != nil { if err := ParseRequest(r, w, &notifications); err != nil {
ErrResponse(w, http.StatusBadRequest, err) ErrMsg(err);
return
} }
// gernate app token // gernate app token
@ -55,6 +54,7 @@ func AddAccountApp(w http.ResponseWriter, r *http.Request) {
session.AppVersion = appVersion session.AppVersion = appVersion
session.Platform = platform session.Platform = platform
session.PushToken = deviceToken session.PushToken = deviceToken
session.PushEnabled = true
if res := tx.Save(session).Error; res != nil { if res := tx.Save(session).Error; res != nil {
return res return res
} }

View File

@ -34,8 +34,7 @@ func SetAccountAccess(w http.ResponseWriter, r *http.Request) {
// parse requested notifications // parse requested notifications
var notifications []Notification var notifications []Notification
if err := ParseRequest(r, w, &notifications); err != nil { if err := ParseRequest(r, w, &notifications); err != nil {
ErrResponse(w, http.StatusBadRequest, err) ErrMsg(err);
return
} }
// gernate app token // gernate app token
@ -54,6 +53,7 @@ func SetAccountAccess(w http.ResponseWriter, r *http.Request) {
AppVersion: appVersion, AppVersion: appVersion,
Platform: platform, Platform: platform,
PushToken: deviceToken, PushToken: deviceToken,
PushEnabled: true,
} }
// save app and delete token // save app and delete token