|
|
|
@ -20,7 +20,7 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
|
|
|
|
|
public activeRoute: ActivatedRoute) {
|
|
|
|
|
super(config);
|
|
|
|
|
this.activeRoute.paramMap.subscribe(params => {
|
|
|
|
|
console.log('params', params)
|
|
|
|
|
console.log('params', params);
|
|
|
|
|
this.config.pollId = params.get('poll');
|
|
|
|
|
this.config.pollSlug = params.get('pollSlug');
|
|
|
|
|
if (!this.config.loading) {
|
|
|
|
@ -41,24 +41,21 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
|
|
|
|
|
const pollSlug = this.activeRoute.snapshot.params.pollSlug;
|
|
|
|
|
|
|
|
|
|
if (!environment.production) {
|
|
|
|
|
console.log('mockPoll3', mockPoll3)
|
|
|
|
|
console.log('mockPoll3', mockPoll3);
|
|
|
|
|
this.config.currentPoll = mockPoll3;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (id) {
|
|
|
|
|
this.config.loading = true;
|
|
|
|
|
this.config.pollId = id;
|
|
|
|
|
// store it in the poll property here
|
|
|
|
|
this.config.getPollById(id).subscribe(
|
|
|
|
|
(res: any) => {
|
|
|
|
|
console.log('res', res);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.config.currentPoll = res;
|
|
|
|
|
this.config.updateCurrentPollFromResponse(res);
|
|
|
|
|
this.config.loading = false;
|
|
|
|
|
}, (e) => {
|
|
|
|
|
// handle need for a password
|
|
|
|
|
console.log('e', e)
|
|
|
|
|
console.log('e', e);
|
|
|
|
|
this.config.handleError(e)
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
@ -66,10 +63,8 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
|
|
|
|
|
this.config.loading = true;
|
|
|
|
|
this.config.getPollByURL(pollSlug).subscribe(
|
|
|
|
|
(res: any) => {
|
|
|
|
|
console.log('res', res)
|
|
|
|
|
this.config.pollId = res.id;
|
|
|
|
|
this.config.currentPoll = res;
|
|
|
|
|
this.config.loading = false;
|
|
|
|
|
this.config.updateCurrentPollFromResponse(res);
|
|
|
|
|
}, (e) => {
|
|
|
|
|
// handle need for a password
|
|
|
|
|
this.config.handleError(e)
|
|
|
|
|