@orangecheck/auth-client 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1373,14 +1373,16 @@ function useWebAuthnList(opts) {
|
|
|
1373
1373
|
});
|
|
1374
1374
|
const j = await r.json();
|
|
1375
1375
|
if (!j.ok || !j.credential) {
|
|
1376
|
-
|
|
1377
|
-
|
|
1376
|
+
const reason = j.reason ?? `rename_failed_${r.status}`;
|
|
1377
|
+
setError(new Error(reason));
|
|
1378
|
+
return { ok: false, reason };
|
|
1378
1379
|
}
|
|
1379
1380
|
await refetch();
|
|
1380
|
-
return j.credential;
|
|
1381
|
+
return { ok: true, credential: j.credential };
|
|
1381
1382
|
} catch (e) {
|
|
1382
|
-
|
|
1383
|
-
|
|
1383
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
1384
|
+
setError(new Error(reason));
|
|
1385
|
+
return { ok: false, reason };
|
|
1384
1386
|
}
|
|
1385
1387
|
},
|
|
1386
1388
|
[authOrigin, refetch]
|
|
@@ -1394,14 +1396,16 @@ function useWebAuthnList(opts) {
|
|
|
1394
1396
|
});
|
|
1395
1397
|
const j = await r.json();
|
|
1396
1398
|
if (!j.ok) {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
+
const reason = j.reason ?? `delete_failed_${r.status}`;
|
|
1400
|
+
setError(new Error(reason));
|
|
1401
|
+
return { ok: false, reason };
|
|
1399
1402
|
}
|
|
1400
1403
|
await refetch();
|
|
1401
|
-
return true;
|
|
1404
|
+
return { ok: true };
|
|
1402
1405
|
} catch (e) {
|
|
1403
|
-
|
|
1404
|
-
|
|
1406
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
1407
|
+
setError(new Error(reason));
|
|
1408
|
+
return { ok: false, reason };
|
|
1405
1409
|
}
|
|
1406
1410
|
},
|
|
1407
1411
|
[authOrigin, refetch]
|