UNPKG

1.22 kBPlain TextView Raw
1import GoogleAuthData from './GoogleAuthData';
2
3class GoogleIdentity extends GoogleAuthData {
4 uid: string;
5 email: string;
6 displayName?: string;
7 photoURL?: string;
8 firstName?: string;
9 lastName?: string;
10
11 constructor(options: any) {
12 super(options);
13 const { uid, email, displayName, photoURL, firstName, lastName } = options;
14
15 this.uid = uid;
16 this.email = email;
17 this.displayName = displayName;
18 this.photoURL = photoURL;
19 this.firstName = firstName;
20 this.lastName = lastName;
21 }
22
23 equals(other: any): boolean {
24 if (!super.equals(other) || !(other instanceof GoogleIdentity)) {
25 return false;
26 }
27
28 return (
29 this.displayName === other.displayName &&
30 this.photoURL === other.photoURL &&
31 this.uid === other.uid &&
32 this.email === other.email &&
33 this.firstName === other.firstName &&
34 this.lastName === other.lastName
35 );
36 }
37
38 toJSON(): { [key: string]: any } {
39 return {
40 ...super.toJSON(),
41 uid: this.uid,
42 email: this.email,
43 displayName: this.displayName,
44 photoURL: this.photoURL,
45 firstName: this.firstName,
46 lastName: this.lastName,
47 };
48 }
49}
50
51export default GoogleIdentity;