mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
🐛 fix undefined choice
This commit is contained in:
parent
49494236cf
commit
1074d219dd
@ -1,5 +1,4 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {environment} from "../../environments/environment";
|
||||
|
||||
interface VoteChoice {
|
||||
votesCount: {
|
||||
@ -8,8 +7,8 @@ interface VoteChoice {
|
||||
maybe: number
|
||||
notAnswered: number
|
||||
};
|
||||
text: string;
|
||||
date: Date;
|
||||
text?: string;
|
||||
date?: Date;
|
||||
answer: 'yes' | 'no' | 'maybe' | null;
|
||||
simpleAnswer: boolean; // enable if we display only a togglable "yes"
|
||||
}
|
||||
@ -25,17 +24,21 @@ interface VoteChoice {
|
||||
})
|
||||
export class VoteChoiceComponent {
|
||||
|
||||
@Input() choice: VoteChoice;
|
||||
@Input() choice: VoteChoice = {
|
||||
date: new Date(),
|
||||
text: 'description ',
|
||||
votesCount: {
|
||||
yes: 0,
|
||||
no: 0,
|
||||
maybe: 0,
|
||||
notAnswered: 0
|
||||
},
|
||||
simpleAnswer: false,
|
||||
answer: null
|
||||
};
|
||||
|
||||
constructor() {
|
||||
if (!environment.production) {
|
||||
// demo content for dev env
|
||||
this.choice = {
|
||||
date: new Date(),
|
||||
text: 'description ',
|
||||
simpleAnswer: false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {
|
||||
|
Loading…
Reference in New Issue
Block a user