Keep WebPush settings (#5879)
This commit is contained in:
parent
ec3b449baa
commit
99242b92bc
4 changed files with 74 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
import axios from 'axios';
|
||||
import { setSettingsToLocalStorage } from '../web_push_subscription';
|
||||
|
||||
export const SET_BROWSER_SUPPORT = 'PUSH_NOTIFICATIONS_SET_BROWSER_SUPPORT';
|
||||
export const SET_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_SET_SUBSCRIPTION';
|
||||
|
@ -42,11 +43,15 @@ export function saveSettings() {
|
|||
const state = getState().get('push_notifications');
|
||||
const subscription = state.get('subscription');
|
||||
const alerts = state.get('alerts');
|
||||
const data = { alerts };
|
||||
|
||||
axios.put(`/api/web/push_subscriptions/${subscription.get('id')}`, {
|
||||
data: {
|
||||
alerts,
|
||||
},
|
||||
data,
|
||||
}).then(() => {
|
||||
const me = getState().getIn(['meta', 'me']);
|
||||
if (me) {
|
||||
setSettingsToLocalStorage(me, data);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue