1 | export class NbAuthResult {
|
2 |
|
3 | constructor(success, response, redirect, errors, messages, token = null) {
|
4 | this.success = success;
|
5 | this.response = response;
|
6 | this.redirect = redirect;
|
7 | this.errors = [];
|
8 | this.messages = [];
|
9 | this.errors = this.errors.concat([errors]);
|
10 | if (errors instanceof Array) {
|
11 | this.errors = errors;
|
12 | }
|
13 | this.messages = this.messages.concat([messages]);
|
14 | if (messages instanceof Array) {
|
15 | this.messages = messages;
|
16 | }
|
17 | this.token = token;
|
18 | }
|
19 | getResponse() {
|
20 | return this.response;
|
21 | }
|
22 | getToken() {
|
23 | return this.token;
|
24 | }
|
25 | getRedirect() {
|
26 | return this.redirect;
|
27 | }
|
28 | getErrors() {
|
29 | return this.errors.filter(val => !!val);
|
30 | }
|
31 | getMessages() {
|
32 | return this.messages.filter(val => !!val);
|
33 | }
|
34 | isSuccess() {
|
35 | return this.success;
|
36 | }
|
37 | isFailure() {
|
38 | return !this.success;
|
39 | }
|
40 | }
|
41 |
|
\ | No newline at end of file |