File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export type CreateHomeParams = {
10
10
rooms : string [ ] ;
11
11
} ;
12
12
13
- export function createHome ( params : CreateHomeParams ) {
13
+ export function createHome ( params : CreateHomeParams ) : Promise < string > {
14
14
return tuya . createHome ( params ) ;
15
15
}
16
16
Original file line number Diff line number Diff line change @@ -34,15 +34,29 @@ export function logout(): Promise<string> {
34
34
return tuya . logout ( ) ;
35
35
}
36
36
37
- // TODO: provide typings
38
- export function getCurrentUser ( ) {
39
- return tuya . getCurrentUser ( ) ;
37
+ export async function getCurrentUser ( ) : Promise < User | null > {
38
+ const user = tuya . getCurrentUser ( ) ;
39
+ // The iOS SDK returns an empty user model but the Android one doesn't.
40
+ return user && user . email ? user : null ;
40
41
}
41
42
42
43
export function cancelAccount ( ) : Promise < string > {
43
44
return tuya . cancelAccount ( ) ;
44
45
}
45
46
47
+ export type User = {
48
+ email : string ;
49
+ username : string ;
50
+ sid : string ;
51
+ timezoneId : string ;
52
+ uid : string ;
53
+ userType : number ;
54
+ headPic : string ;
55
+ mobile : string ;
56
+ nickName : string ;
57
+ phoneCode : string ;
58
+ } ;
59
+
46
60
export type RegisterAccountWithEmailParams = {
47
61
countryCode : string ;
48
62
email : string ;
You can’t perform that action at this time.
0 commit comments