diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 38f8c31e..6130356b 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -182,8 +182,8 @@ export class ConfigService extends PollConfig { this.loading = true; - this.http.get(`${this.baseHref}/my-polls`, - this.makeHeaders({email: this.myEmail}), + this.http.get(`${this.baseHref}/send-polls-to-user/${this.myEmail}`, + this.makeHeaders(), ) .subscribe(res => { // message: 'Trouvé! Allez voir votre boite email', @@ -191,8 +191,8 @@ export class ConfigService extends PollConfig { this.loading = false; this.messageService.add({ severity: 'success', - summary: 'Service Message', - detail: 'Via MessageService' + summary: 'Succès', + detail: `Vos infos de sondages vous ont été transmises. Allez voir votre boite email ${this.myEmail}` }); }, (e) => { this.handleError(e) @@ -269,16 +269,8 @@ export class ConfigService extends PollConfig { */ createPoll() { this.loading = true; + this.createPollFromConfig(this.getPollConfig()) - return this.http.get(`${this.baseHref}/`, this.makeHeaders()) - .subscribe((res) => { - this.createPollFromConfig(this.getPollConfig()) - }, - (e) => { - this.handleError(e) - } - ) - ; } @@ -290,7 +282,8 @@ export class ConfigService extends PollConfig { createPollFromConfig(config: any) { this.loading = true; return this.http.post(`${this.baseHref}/poll`, - this.makeHeaders({config: config})) + config, + this.makeHeaders()) .subscribe((res: any) => { // redirect to the page to administrate the new poll this.messageService.add({severity: 'success', summary: 'Sondage Créé',}); @@ -342,7 +335,7 @@ export class ConfigService extends PollConfig { */ updateVote(voteStack: any) { this.http.put( - `${this.baseHref}/poll/${this.pollId}/vote`, + `${this.baseHref}/vote-stack/${voteStack.id}`, voteStack, this.makeHeaders()) .subscribe((res: any) => { @@ -363,6 +356,7 @@ export class ConfigService extends PollConfig { if (!comment && this.myComment) { comment = { name: this.myName, + email: this.myEmail, date: new Date(), text: this.myComment, } @@ -375,7 +369,7 @@ export class ConfigService extends PollConfig { this.messageService.add({ severity: 'success', summary: 'Commentaire Créé', - detail: 'Via MessageService' + detail: comment.text }); // empty comment after success this.myComment = ''; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index cc5c5ac1..10d81771 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,7 +5,7 @@ let baseURL = "http://localhost:8000/"; const baseURLProd = "https://framadate.org/"; const baseURLDemo = "https://framadate-api.cipherbliss.com/"; const apiVersion = 1; -const testOnDemo = 0; +const testOnDemo = 1; if (testOnDemo) { baseURL = baseURLDemo; }