Skip to content

Commit 50f4371

Browse files
committed
Fix push module getCredential
1 parent 794be70 commit 50f4371

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

android/src/main/java/com/authsignal/react/AuthsignalPushModule.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ class AuthsignalPushModule(private val reactContext: ReactApplicationContext) :
4646
val errorCode = response.errorCode ?: defaultError
4747

4848
promise.reject(errorCode, response.error)
49-
} else {
49+
} else if (response.data != null) {
5050
val credential = response.data
5151
val map = Arguments.createMap()
5252
map.putString("credentialId", credential!!.credentialId)
5353
map.putString("createdAt", credential.createdAt)
5454
map.putString("userId", credential.userId)
5555
map.putString("lastAuthenticatedAt", credential.lastAuthenticatedAt)
5656
promise.resolve(map)
57+
} else {
58+
promise.resolve(null)
5759
}
5860
}
5961
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-authsignal",
3-
"version": "2.0.0-alpha3",
3+
"version": "2.0.0-alpha4",
44
"description": "The official Authsignal React Native library.",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/inapp.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export class AuthsignalInApp {
3737
this.enableLogging = enableLogging;
3838
}
3939

40-
async getCredential(): Promise<AuthsignalResponse<AppCredential>> {
40+
async getCredential(): Promise<
41+
AuthsignalResponse<AppCredential | undefined>
42+
> {
4143
await this.ensureModuleIsInitialized();
4244

4345
try {

src/push.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export class AuthsignalPush {
3838
this.enableLogging = enableLogging;
3939
}
4040

41-
async getCredential(): Promise<AuthsignalResponse<AppCredential>> {
41+
async getCredential(): Promise<
42+
AuthsignalResponse<AppCredential | undefined>
43+
> {
4244
await this.ensureModuleIsInitialized();
4345

4446
try {

src/qr.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export class AuthsignalQrCode {
3939
this.enableLogging = enableLogging;
4040
}
4141

42-
async getCredential(): Promise<AuthsignalResponse<AppCredential>> {
42+
async getCredential(): Promise<
43+
AuthsignalResponse<AppCredential | undefined>
44+
> {
4345
await this.ensureModuleIsInitialized();
4446

4547
try {

0 commit comments

Comments
 (0)