forked from apxtri/apxtrib
29 lines
877 B
JavaScript
29 lines
877 B
JavaScript
|
"use strict";
|
||
|
var pwa = pwa || {};
|
||
|
/*
|
||
|
Manage notification
|
||
|
|
||
|
Get notification after tomenu was load
|
||
|
|
||
|
from /components/notification
|
||
|
____________________
|
||
|
|
||
|
*/
|
||
|
//--##
|
||
|
pwa.notification = {};
|
||
|
|
||
|
pwa.notification.update = () => {
|
||
|
console.log( 'get notification update for a user' );
|
||
|
axios.get( `https://${pwa.state.data.ctx.urlbackoffice}/notifications/user`, { headers: pwa.state.data.headers } )
|
||
|
.then( rep => {
|
||
|
console.log( "list des notifs", rep.data.payload.data )
|
||
|
rep.data.payload.data.number = rep.data.payload.data.notifs.length;
|
||
|
document.getElementById( "topbarmenuright" )
|
||
|
.innerHTML = Mustache.render( pwa.state.data.tpl.notiflist, rep.data.payload.data ) + document.getElementById( "topbarmenuright" )
|
||
|
.innerHTML;
|
||
|
} )
|
||
|
.catch( err => {
|
||
|
console.log( `Err pwa.notification.update data for user into header ${pwa.state.data.headers}`, err );
|
||
|
} );
|
||
|
};
|