@ic-reactor/react 0.4.3 → 0.4.4
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/hooks/auth.d.ts +1 -1
- package/dist/hooks/auth.js +7 -6
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +2 -2
package/dist/hooks/auth.d.ts
CHANGED
package/dist/hooks/auth.js
CHANGED
|
@@ -48,27 +48,28 @@ const getAuthHooks = (agentManager) => {
|
|
|
48
48
|
if (!authClient) {
|
|
49
49
|
throw new Error("Auth client not initialized");
|
|
50
50
|
}
|
|
51
|
-
yield authClient.login(Object.assign(Object.assign({ identityProvider: isLocalEnv
|
|
51
|
+
return yield authClient.login(Object.assign(Object.assign({ identityProvider: isLocalEnv
|
|
52
52
|
? "https://identity.ic0.app/#authorize"
|
|
53
53
|
: "http://rdmx6-jaaaa-aaaaa-aaadq-cai.localhost:4943/#authorize" }, options), { onSuccess: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
54
|
var _a;
|
|
55
|
-
setLoginLoading(false);
|
|
56
55
|
yield authenticate();
|
|
57
56
|
(_a = options === null || options === void 0 ? void 0 : options.onSuccess) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
58
57
|
onLoginSuccess === null || onLoginSuccess === void 0 ? void 0 : onLoginSuccess();
|
|
59
58
|
}), onError: (e) => {
|
|
60
59
|
var _a;
|
|
61
|
-
setLoginError(e);
|
|
62
|
-
setLoginLoading(false);
|
|
63
60
|
(_a = options === null || options === void 0 ? void 0 : options.onError) === null || _a === void 0 ? void 0 : _a.call(options, e);
|
|
64
|
-
|
|
61
|
+
const error = new Error("Login failed:" + e);
|
|
62
|
+
setLoginError(error);
|
|
63
|
+
onLoginError === null || onLoginError === void 0 ? void 0 : onLoginError(error);
|
|
65
64
|
} }));
|
|
66
65
|
}
|
|
67
66
|
catch (e) {
|
|
68
|
-
setLoginLoading(false);
|
|
69
67
|
setLoginError(e);
|
|
70
68
|
onLoginError === null || onLoginError === void 0 ? void 0 : onLoginError(e);
|
|
71
69
|
}
|
|
70
|
+
finally {
|
|
71
|
+
setLoginLoading(false);
|
|
72
|
+
}
|
|
72
73
|
}), [authClient, onLogin, onLoginSuccess, onLoginError, isLocalEnv]);
|
|
73
74
|
const logout = (0, react_1.useCallback)((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
75
|
if (!authClient) {
|
package/dist/index.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export type * from "@ic-reactor/store/dist/actor/types";
|
|
|
4
4
|
export type AuthArgs = {
|
|
5
5
|
onAuthentication?: () => void;
|
|
6
6
|
onAuthenticationSuccess?: (identity: Identity) => void;
|
|
7
|
-
onAuthenticationFailure?: (error: Error |
|
|
7
|
+
onAuthenticationFailure?: (error: Error | undefined) => void;
|
|
8
8
|
onLoginSuccess?: () => void;
|
|
9
|
-
onLoginError?: (error: Error |
|
|
9
|
+
onLoginError?: (error: Error | undefined) => void;
|
|
10
10
|
onLogin?: () => void;
|
|
11
11
|
onLoggedOut?: () => void;
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "A React library for interacting with Dfinity actors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react": ">=16.8",
|
|
49
49
|
"zustand": "4.4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "be65990c31a4e7a86539fec2c6600de3e32a0c79"
|
|
52
52
|
}
|