remove loader service to fix api calls

This commit is contained in:
Tykayn 2021-05-20 14:49:37 +02:00 committed by tykayn
parent 597bde003f
commit e66ca4448b

View File

@ -96,13 +96,12 @@ export class ApiService {
console.log('Error', error.message); console.log('Error', error.message);
} }
console.log(error.config); console.log(error.config);
this.loaderService.setStatus(false); // this.loaderService.setStatus(false);
} }
public async createPoll(poll: Poll): Promise<Subscription> { public async createPoll(poll: Poll): Promise<Subscription> {
// this.loaderService.setStatus(true); // this.loaderService.setStatus(true);
console.log('createPoll config', poll); console.log('createPoll config', poll);
this.loaderService.setStatus(true);
return this.axiosInstance.post( return this.axiosInstance.post(
`${this.baseHref}${currentApiRoutes['api_new_poll']}`, `${this.baseHref}${currentApiRoutes['api_new_poll']}`,
poll, poll,
@ -295,17 +294,18 @@ export class ApiService {
ApiService.handleError(error); ApiService.handleError(error);
} }
} }
///////////////////// /////////////////////
// PRIVATE METHODS // // PRIVATE METHODS //
///////////////////// /////////////////////
public async sendEmailToUserOfItsPollsList(email: string): Promise<void> { public async sendEmailToUserOfItsPollsList(email: string): Promise<void> {
if (this.loaderService.isLoading) { // if (this.loaderService.isLoading) {
return; // return;
} // }
// If user is not authenticated: the list of polls is send to user's email by the backend. // If user is not authenticated: the list of polls is send to user's email by the backend.
try { try {
this.loaderService.setStatus(false); // this.loaderService.setStatus(false);
await this.axiosInstance.get<Poll[]>( await this.axiosInstance.get<Poll[]>(
`${this.usersEndpoint}/${email}${this.usersPollsEndpoint}${this.usersPollsSendEmailEndpoint}` `${this.usersEndpoint}/${email}${this.usersPollsEndpoint}${this.usersPollsSendEmailEndpoint}`
); );