Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Injectable } from '@angular/core';
  2. import { HttpService } from "../services/http.service";
  3. import { Constants } from '../pages/constants';
  4. import { Observable } from 'rxjs';
  5.  
  6. @Injectable()
  7. export class UsuarioProvider {
  8.     constructor(private http: HttpService) {}
  9.  
  10.     alterarIndicadorNotificacao(idUsuario, indNotificacao): Observable<any> {
  11.         return this.http.put(`${Constants.API_ENDPOINT}/usuario/${idUsuario}/notificacao`, {
  12.             ind_notificacao: indNotificacao
  13.         });
  14.     }
  15.  
  16.     alterarSenha(idUsuario, senhaAtual, novaSenha): Observable<any> {
  17.         return this.http.put(`${Constants.API_ENDPOINT}/usuario/${idUsuario}/alterarsenha`, {
  18.             senha_atual: senhaAtual,
  19.             nova_senha: novaSenha
  20.         });
  21.     }
  22.  
  23.     alterarEmail(idUsuario, senhaAtual, novoEmail): Observable<any> {
  24.         return this.http.put(`${Constants.API_ENDPOINT}/usuario/${idUsuario}/email`, {
  25.             novo_email: novoEmail,
  26.             senha_atual: senhaAtual
  27.         });
  28.     }
  29.  
  30.     emailExiste(email): Observable<any> {
  31.         return this.http.get(`${Constants.API_ENDPOINT}/usuario/email/${email}`);
  32.     }
  33.  
  34.     facebookIdExiste(id): Observable<any> {
  35.         return this.http.get(`${Constants.API_ENDPOINT}/usuario/facebook/${id}`);
  36.     }
  37.  
  38.     autenticar(email: string, senha: string): Observable<any> {
  39.         return this.http.post(`${Constants.API_ENDPOINT}/autenticar`, {email, senha});
  40.     }
  41.  
  42.     autenticarToken(email: string, fb_id: string | number, fb_token: string, uuid?: string): Observable<any> {
  43.         return this.http.post(`${Constants.API_ENDPOINT}/autenticar/facebook`, {email, fb_id, fb_token, uuid});
  44.     }
  45.  
  46.     cadastrar(dados): Observable<any> {
  47.         return this.http.post(`${Constants.API_ENDPOINT}/usuario`, dados);
  48.     }
  49.  
  50.     convidarAmigo(nome, email): Observable<any> {
  51.         return this.http.post(`${Constants.API_ENDPOINT}/usuario/convidar-amigo`, {nome, email});
  52.     }
  53.  
  54.     buscarNotificacoes() {
  55.         return this.http.get(`${Constants.API_ENDPOINT}/notificacao`);
  56.     }
  57.  
  58.     buscarTotalNotificacoes() {
  59.         return this.http.get(`${Constants.API_ENDPOINT}/notificacao/total`);
  60.     }
  61.  
  62.     atualizarNotificacoes(data) {
  63.         return this.http.put(`${Constants.API_ENDPOINT}/notificacao`, {data});
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement