diff --git a/mocks/old-stuff/config/PollConfig.ts b/mocks/old-stuff/config/PollConfig.ts index 99ceac24..32e5d94f 100644 --- a/mocks/old-stuff/config/PollConfig.ts +++ b/mocks/old-stuff/config/PollConfig.ts @@ -50,7 +50,7 @@ export class PollConfig { expirationDate = ''; // expiracy date voteStackId = null; // id of the vote stack to update pollId = null; // id of the current poll when created. data given by the backend api - pollSlug = null; // id of the current poll when created. data given by the backend api + custom_url = null; // id of the current poll when created. data given by the backend api currentPoll; // current poll selected with createPoll or getPoll of ConfigService passwordAccess = 0; password = ''; diff --git a/mocks/old-stuff/services/config.service.ts b/mocks/old-stuff/services/config.service.ts index fe22909f..9a1268f2 100644 --- a/mocks/old-stuff/services/config.service.ts +++ b/mocks/old-stuff/services/config.service.ts @@ -20,6 +20,7 @@ import { mockMyPolls } from '../mocks/mockmypolls'; export class ConfigService extends PollConfig { loading = false; apiBaseHref: any = environment.api.baseHref; + pollSlug: string; constructor( private http: HttpClient, diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 3a717d84..7197c678 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -143,15 +143,21 @@ export class PollService implements Resolve { return str + '-' + this.uuidService.getUUID(); } - public async saveCurrentPoll(): Promise { - const pollUrl: Subscription = await this.apiService.createPoll(this._poll.getValue()); - // TODO: Maybe handle the url to update currentPoll according to backend response - if (pollUrl) { - console.log('pollUrl', pollUrl); - this.toastService.display('Le sondage a été enregistré.'); - } else { - this.toastService.display('Le sondage n’a été correctement enregistré, veuillez ré-essayer.'); - } + public async saveCurrentPoll(): Promise { + // .then((resp) => { + // console.log('resp', resp); + // if (pollUrl) { + // console.log('pollUrl', pollUrl); + // this.toastService.display('Le sondage a été enregistré.'); + // // TODO: redirect to view + // } else { + // this.toastService.display('Le sondage n’a été correctement enregistré, veuillez ré-essayer.'); + // } + // }) + // .catch((err) => { + // console.error('err', err); + // }); + return await this.apiService.createPoll(this._poll.getValue()); } public saveParticipation(choice: Choice, user: Owner, response: Answer): void { diff --git a/src/app/features/administration/form/advanced-config/advanced-config.component.html b/src/app/features/administration/form/advanced-config/advanced-config.component.html index 1bd574b7..d378952f 100644 --- a/src/app/features/administration/form/advanced-config/advanced-config.component.html +++ b/src/app/features/administration/form/advanced-config/advanced-config.component.html @@ -31,14 +31,14 @@ {{ urlPrefix }} - {{ form.controls.slug.value }} + {{ form.controls.custom_url.value }} - + +
@@ -37,11 +37,11 @@ - - - - - + +