diff options
Diffstat (limited to 'src/models/News.js')
-rw-r--r-- | src/models/News.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/models/News.js b/src/models/News.js new file mode 100644 index 000000000..e8953ff8c --- /dev/null +++ b/src/models/News.js | |||
@@ -0,0 +1,19 @@ | |||
1 | // @flow | ||
2 | |||
3 | export default class News { | ||
4 | id: string = ''; | ||
5 | message: string = ''; | ||
6 | type: string = 'primary'; | ||
7 | sticky: bool = false; | ||
8 | |||
9 | constructor(data: Object) { | ||
10 | if (!data.id) { | ||
11 | throw Error('News requires Id'); | ||
12 | } | ||
13 | |||
14 | this.id = data.id; | ||
15 | this.message = data.message || this.message; | ||
16 | this.type = data.type || this.type; | ||
17 | this.sticky = data.sticky !== undefined ? data.sticky : this.sticky; | ||
18 | } | ||
19 | } | ||