forked from tykayn/funky-framadate-front
fix loading status, position of timeslices on large screen :style:
This commit is contained in:
parent
558f29843b
commit
597bde003f
@ -20,9 +20,6 @@ const apiEndpoints = environment.api.endpoints;
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ApiService {
|
export class ApiService {
|
||||||
private static loader: LoaderService;
|
|
||||||
private useDevLocalServer = true;
|
|
||||||
private devLocalServerBaseHref = 'http://localhost:8000/';
|
|
||||||
private axiosInstance: AxiosInstance;
|
private axiosInstance: AxiosInstance;
|
||||||
private readonly pollsEndpoint = apiEndpoints.polls.name;
|
private readonly pollsEndpoint = apiEndpoints.polls.name;
|
||||||
private readonly answersEndpoint = apiEndpoints.polls.answers.name;
|
private readonly answersEndpoint = apiEndpoints.polls.answers.name;
|
||||||
@ -32,8 +29,9 @@ export class ApiService {
|
|||||||
private readonly usersPollsEndpoint = apiEndpoints.users.polls.name;
|
private readonly usersPollsEndpoint = apiEndpoints.users.polls.name;
|
||||||
private readonly usersPollsSendEmailEndpoint = apiEndpoints.users.polls.sendEmail.name;
|
private readonly usersPollsSendEmailEndpoint = apiEndpoints.users.polls.sendEmail.name;
|
||||||
private baseHref: string;
|
private baseHref: string;
|
||||||
|
private static loaderService: LoaderService;
|
||||||
|
|
||||||
constructor(private http: HttpClient, private loader: LoaderService, private toastService: ToastService) {
|
constructor(private http: HttpClient, private loaderService: LoaderService) {
|
||||||
this.baseHref = apiBaseHref;
|
this.baseHref = apiBaseHref;
|
||||||
|
|
||||||
this.axiosInstance = axios.create({ baseURL: apiBaseHref });
|
this.axiosInstance = axios.create({ baseURL: apiBaseHref });
|
||||||
@ -81,7 +79,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static handleError(error): void {
|
private static handleError(error): void {
|
||||||
// this.loader.setStatus(true);
|
// this.loaderService.setStatus(true);
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
// The request was made and the server responded with a status code
|
// The request was made and the server responded with a status code
|
||||||
// that falls out of the range of 2xx
|
// that falls out of the range of 2xx
|
||||||
@ -98,13 +96,13 @@ export class ApiService {
|
|||||||
console.log('Error', error.message);
|
console.log('Error', error.message);
|
||||||
}
|
}
|
||||||
console.log(error.config);
|
console.log(error.config);
|
||||||
this.loader.setStatus(false);
|
this.loaderService.setStatus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createPoll(poll: Poll): Promise<Subscription> {
|
public async createPoll(poll: Poll): Promise<Subscription> {
|
||||||
// this.loader.setStatus(true);
|
// this.loaderService.setStatus(true);
|
||||||
console.log('createPoll config', poll);
|
console.log('createPoll config', poll);
|
||||||
this.loader.setStatus(true);
|
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,
|
||||||
@ -302,12 +300,12 @@ export class ApiService {
|
|||||||
/////////////////////
|
/////////////////////
|
||||||
|
|
||||||
public async sendEmailToUserOfItsPollsList(email: string): Promise<void> {
|
public async sendEmailToUserOfItsPollsList(email: string): Promise<void> {
|
||||||
if (this.loader.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.loader.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}`
|
||||||
);
|
);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
}
|
}
|
||||||
.several-times {
|
.several-times {
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
|
width: 96.5%;
|
||||||
}
|
}
|
||||||
.date-choice {
|
.date-choice {
|
||||||
&:nth-child(odd) {
|
&:nth-child(odd) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user