aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/News.js
blob: e8953ff8c841f38c43039dc3624582672ab04f94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// @flow

export default class News {
  id: string = '';
  message: string = '';
  type: string = 'primary';
  sticky: bool = false;

  constructor(data: Object) {
    if (!data.id) {
      throw Error('News requires Id');
    }

    this.id = data.id;
    this.message = data.message || this.message;
    this.type = data.type || this.type;
    this.sticky = data.sticky !== undefined ? data.sticky : this.sticky;
  }
}