Skip to content

Commit 70796c5

Browse files
authored
fix: sign otp (#96)
1 parent 74ed80e commit 70796c5

File tree

1 file changed

+5
-5
lines changed
  • src/application/services/js-services/http

1 file changed

+5
-5
lines changed

src/application/services/js-services/http/gotrue.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ export async function signInOTP ({
6767
const data = response?.data;
6868

6969
if (data) {
70-
if (data.code !== 0) {
70+
if (!data.code) {
71+
refreshSessionToken(JSON.stringify(data));
72+
emit(EventType.SESSION_VALID);
73+
afterAuth();
74+
} else {
7175
emit(EventType.SESSION_INVALID);
7276
return Promise.reject({
7377
code: data.code,
7478
message: data.msg,
7579
});
7680
}
77-
78-
refreshSessionToken(JSON.stringify(data));
79-
emit(EventType.SESSION_VALID);
80-
afterAuth();
8181
} else {
8282
emit(EventType.SESSION_INVALID);
8383
return Promise.reject({

0 commit comments

Comments
 (0)