@calimero-network/mero-react 4.1.0 → 4.1.1

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.cjs CHANGED
@@ -268,14 +268,19 @@ function MeroProvider({
268
268
  },
269
269
  [timeoutMs, tokenStore]
270
270
  );
271
- const checkAuth = react.useCallback(async (instance) => {
272
- try {
273
- await instance.admin.getContexts();
274
- return true;
275
- } catch {
276
- return false;
277
- }
278
- }, []);
271
+ const checkAuth = react.useCallback(
272
+ async (instance) => {
273
+ const accessToken = tokenStore.getTokens()?.access_token;
274
+ if (!accessToken) return false;
275
+ try {
276
+ const { valid } = await instance.auth.validateToken(accessToken);
277
+ return valid;
278
+ } catch {
279
+ return false;
280
+ }
281
+ },
282
+ [tokenStore]
283
+ );
279
284
  const connectToNode = react.useCallback(
280
285
  (url) => {
281
286
  if (!isBrowser) return;