diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-08-17 05:07:38 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 05:07:38 +0530 |
commit | 0fbee32c27a6efdfe88534303922d189ddbba817 (patch) | |
tree | 2b9dddba64ff1519e293c64b3b42b4d9172ec4d3 /src/models/News.ts | |
parent | Revert "chore: update outdated node_modules (#1807)" (diff) | |
download | ferdium-app-0fbee32c27a6efdfe88534303922d189ddbba817.tar.gz ferdium-app-0fbee32c27a6efdfe88534303922d189ddbba817.tar.zst ferdium-app-0fbee32c27a6efdfe88534303922d189ddbba817.zip |
Typescript conversion (#1805)
Diffstat (limited to 'src/models/News.ts')
-rw-r--r-- | src/models/News.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/models/News.ts b/src/models/News.ts new file mode 100644 index 000000000..3db812937 --- /dev/null +++ b/src/models/News.ts | |||
@@ -0,0 +1,29 @@ | |||
1 | // @flow | ||
2 | |||
3 | interface INews { | ||
4 | id: string; | ||
5 | message: string; | ||
6 | type: string; | ||
7 | sticky: boolean | undefined; | ||
8 | } | ||
9 | |||
10 | export default class News { | ||
11 | id: string = ''; | ||
12 | |||
13 | message: string = ''; | ||
14 | |||
15 | type: string = 'primary'; | ||
16 | |||
17 | sticky: boolean = false; | ||
18 | |||
19 | constructor(data: INews) { | ||
20 | if (!data.id) { | ||
21 | throw Error('News requires Id'); | ||
22 | } | ||
23 | |||
24 | this.id = data.id; | ||
25 | this.message = data.message || this.message; | ||
26 | this.type = data.type || this.type; | ||
27 | this.sticky = data.sticky !== undefined ? data.sticky : this.sticky; | ||
28 | } | ||
29 | } | ||