mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
33 lines
926 B
TypeScript
33 lines
926 B
TypeScript
|
import {Injectable} from '@angular/core';
|
||
|
import {ConfigService} from "../config.service";
|
||
|
import {HttpClient} from "@angular/common/http";
|
||
|
import {environment} from "../../environments/environment";
|
||
|
|
||
|
class JsonResponse {
|
||
|
message: string;
|
||
|
data: string;
|
||
|
}
|
||
|
|
||
|
@Injectable({
|
||
|
providedIn: 'root'
|
||
|
})
|
||
|
export class PollServiceService {
|
||
|
|
||
|
private baseHref: string = environment.baseApiHref;
|
||
|
|
||
|
constructor(private configService: ConfigService,
|
||
|
private http: HttpClient) {
|
||
|
}
|
||
|
|
||
|
findPollsByEmail(email: string) {
|
||
|
// TODO check if the person has a key to retrieve her polls
|
||
|
// If no key is found in the localstorage, ask the backend to send an email to the user
|
||
|
|
||
|
this.configService.myEmail = email;
|
||
|
this.http.get(this.baseHref + '/').subscribe(res => {
|
||
|
this.configService.myPolls = res;
|
||
|
}, err => console.error('err', err)
|
||
|
)
|
||
|
}
|
||
|
}
|