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 {Component, Input} from '@angular/core';
|
||||||
import {environment} from "../../environments/environment";
|
|
||||||
|
|
||||||
interface VoteChoice {
|
interface VoteChoice {
|
||||||
votesCount: {
|
votesCount: {
|
||||||
@ -8,8 +7,8 @@ interface VoteChoice {
|
|||||||
maybe: number
|
maybe: number
|
||||||
notAnswered: number
|
notAnswered: number
|
||||||
};
|
};
|
||||||
text: string;
|
text?: string;
|
||||||
date: Date;
|
date?: Date;
|
||||||
answer: 'yes' | 'no' | 'maybe' | null;
|
answer: 'yes' | 'no' | 'maybe' | null;
|
||||||
simpleAnswer: boolean; // enable if we display only a togglable "yes"
|
simpleAnswer: boolean; // enable if we display only a togglable "yes"
|
||||||
}
|
}
|
||||||
@ -25,17 +24,21 @@ interface VoteChoice {
|
|||||||
})
|
})
|
||||||
export class VoteChoiceComponent {
|
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() {
|
constructor() {
|
||||||
if (!environment.production) {
|
|
||||||
// demo content for dev env
|
|
||||||
this.choice = {
|
|
||||||
date: new Date(),
|
|
||||||
text: 'description ',
|
|
||||||
simpleAnswer: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {
|
setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user