Notification done

This commit is contained in:
Eudes Inácio
2023-01-24 14:43:02 +01:00
29 changed files with 241 additions and 157 deletions
+3 -17
View File
@@ -100,16 +100,9 @@ export class NotificationsService {
const geturl = environment.apiURL + 'notifications/token';
PushNotifications.addListener('registration',
(token: Token) => {
this.storageService.store(username, token.value);
this.storageService.get(username).then(value => {
this.storageService.get(AuthConnstants.USER).then(res => {
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: res.UserId,
UserId: SessionStore.user.UserId,
TokenId: token.value,
Status: 1,
Service: 1
@@ -117,17 +110,10 @@ export class NotificationsService {
this.http.post<Tokenn>(`${geturl}`, body, { headers }).subscribe(data => {
this.active = true
//console.log(data)
console.log(data)
}, (error) => {
//console.log(error)
console.log(error)
})
}).catch((error) => {
console.error('storage authorization', error)
});;
}).catch((error) => {
console.error('storage getAndPostToken', error)
});
}
);
}