Files
doneit-web/src/app/services/notifications.service.ts
T
2021-02-01 13:31:33 +01:00

31 lines
769 B
TypeScript

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);
}
}