mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Save device token on middleware
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Token } from '../models/token.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NotificationsService {
|
||||
|
||||
constructor(private http: HttpClient,) { }
|
||||
|
||||
getTokenByUserIdAndId(user, userID) {
|
||||
const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
|
||||
return this.http.get<Token[]>(`${geturl}`);
|
||||
}
|
||||
|
||||
postToken(userId, token) {
|
||||
const geturl = environment.apiURL + 'notifications/token';
|
||||
|
||||
let data = {
|
||||
UserId: userId,
|
||||
TokenId: token,
|
||||
Status: 1,
|
||||
Service: 2
|
||||
}
|
||||
return this.http.post<Token[]>(`${geturl}`,data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user