@mezo-org/passport 0.4.0-dev.15 → 0.4.0-dev.16
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.
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to
|
|
3
|
-
* By calling the
|
|
2
|
+
* Hook to refresh the passport using query invalidation mechanism.
|
|
3
|
+
* By calling the refresh function, the latest data will be refetched as soon as possible.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
-
* const {
|
|
6
|
+
* const { refreshCurrentAccount, refreshUsdConversion } = useRefreshPassport()
|
|
7
7
|
*
|
|
8
|
-
* // Call this function to
|
|
9
|
-
* const
|
|
10
|
-
* await
|
|
8
|
+
* // Call this function to refresh the current account
|
|
9
|
+
* const handlerefreshCurrentAccount = async () => {
|
|
10
|
+
* await refreshCurrentAccount()
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
13
|
export declare function useRefreshPassport(): {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
refreshCurrentAccount: () => Promise<void>;
|
|
15
|
+
refreshUsdConversion: () => Promise<void>;
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=useRefreshPassport.d.ts.map
|
|
@@ -2,28 +2,28 @@ import { useQueryClient } from "@tanstack/react-query";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { QUERY_KEYS } from "./constants";
|
|
4
4
|
/**
|
|
5
|
-
* Hook to
|
|
6
|
-
* By calling the
|
|
5
|
+
* Hook to refresh the passport using query invalidation mechanism.
|
|
6
|
+
* By calling the refresh function, the latest data will be refetched as soon as possible.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* const {
|
|
9
|
+
* const { refreshCurrentAccount, refreshUsdConversion } = useRefreshPassport()
|
|
10
10
|
*
|
|
11
|
-
* // Call this function to
|
|
12
|
-
* const
|
|
13
|
-
* await
|
|
11
|
+
* // Call this function to refresh the current account
|
|
12
|
+
* const handlerefreshCurrentAccount = async () => {
|
|
13
|
+
* await refreshCurrentAccount()
|
|
14
14
|
* }
|
|
15
15
|
*/
|
|
16
16
|
export function useRefreshPassport() {
|
|
17
17
|
const queryClient = useQueryClient();
|
|
18
|
-
const
|
|
18
|
+
const refreshCurrentAccount = useCallback(() => queryClient.invalidateQueries({
|
|
19
19
|
queryKey: [QUERY_KEYS.ACCOUNT, QUERY_KEYS.CURRENT],
|
|
20
20
|
}), [queryClient]);
|
|
21
|
-
const
|
|
21
|
+
const refreshUsdConversion = useCallback(() => queryClient.invalidateQueries({
|
|
22
22
|
queryKey: [QUERY_KEYS.ASSETS_USD_CONVERSION],
|
|
23
23
|
}), [queryClient]);
|
|
24
24
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
refreshCurrentAccount,
|
|
26
|
+
refreshUsdConversion,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=useRefreshPassport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefreshPassport.js","sourceRoot":"","sources":["../../../src/hooks/useRefreshPassport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,MAAM,
|
|
1
|
+
{"version":3,"file":"useRefreshPassport.js","sourceRoot":"","sources":["../../../src/hooks/useRefreshPassport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,MAAM,qBAAqB,GAAG,WAAW,CACvC,GAAG,EAAE,CACH,WAAW,CAAC,iBAAiB,CAAC;QAC5B,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;KACnD,CAAC,EACJ,CAAC,WAAW,CAAC,CACd,CAAA;IAED,MAAM,oBAAoB,GAAG,WAAW,CACtC,GAAG,EAAE,CACH,WAAW,CAAC,iBAAiB,CAAC;QAC5B,QAAQ,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC;KAC7C,CAAC,EACJ,CAAC,WAAW,CAAC,CACd,CAAA;IAED,OAAO;QACL,qBAAqB;QACrB,oBAAoB;KACrB,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,21 +3,21 @@ import { useCallback } from "react"
|
|
|
3
3
|
import { QUERY_KEYS } from "./constants"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Hook to
|
|
7
|
-
* By calling the
|
|
6
|
+
* Hook to refresh the passport using query invalidation mechanism.
|
|
7
|
+
* By calling the refresh function, the latest data will be refetched as soon as possible.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* const {
|
|
10
|
+
* const { refreshCurrentAccount, refreshUsdConversion } = useRefreshPassport()
|
|
11
11
|
*
|
|
12
|
-
* // Call this function to
|
|
13
|
-
* const
|
|
14
|
-
* await
|
|
12
|
+
* // Call this function to refresh the current account
|
|
13
|
+
* const handlerefreshCurrentAccount = async () => {
|
|
14
|
+
* await refreshCurrentAccount()
|
|
15
15
|
* }
|
|
16
16
|
*/
|
|
17
17
|
export function useRefreshPassport() {
|
|
18
18
|
const queryClient = useQueryClient()
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const refreshCurrentAccount = useCallback(
|
|
21
21
|
() =>
|
|
22
22
|
queryClient.invalidateQueries({
|
|
23
23
|
queryKey: [QUERY_KEYS.ACCOUNT, QUERY_KEYS.CURRENT],
|
|
@@ -25,7 +25,7 @@ export function useRefreshPassport() {
|
|
|
25
25
|
[queryClient],
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const refreshUsdConversion = useCallback(
|
|
29
29
|
() =>
|
|
30
30
|
queryClient.invalidateQueries({
|
|
31
31
|
queryKey: [QUERY_KEYS.ASSETS_USD_CONVERSION],
|
|
@@ -34,7 +34,7 @@ export function useRefreshPassport() {
|
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
refreshCurrentAccount,
|
|
38
|
+
refreshUsdConversion,
|
|
39
39
|
}
|
|
40
40
|
}
|