@schemavaults/auth-react-provider 0.16.7 → 0.16.8
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/use-admin.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import useCurrentUserWithRevalidation from "./use-current-user-swr";
|
|
3
3
|
export function useAdmin() {
|
|
4
|
-
|
|
4
|
+
// Sessions restored from the refresh-token cookie alone (e.g. after local
|
|
5
|
+
// storage was cleared, or a login performed outside this tab) have no
|
|
6
|
+
// in-memory user data, so the revalidating hook's whoami fallback is
|
|
7
|
+
// required for admin-gated UI to appear for them at all.
|
|
8
|
+
const currentUser = useCurrentUserWithRevalidation();
|
|
5
9
|
return currentUser?.admin ?? false;
|
|
6
10
|
}
|
|
7
11
|
export default useAdmin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-admin.js","sourceRoot":"","sources":["../../src/hooks/use-admin.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,
|
|
1
|
+
{"version":3,"file":"use-admin.js","sourceRoot":"","sources":["../../src/hooks/use-admin.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,8BAA8B,MAAM,wBAAwB,CAAC;AAEpE,MAAM,UAAU,QAAQ;IACtB,0EAA0E;IAC1E,sEAAsE;IACtE,qEAAqE;IACrE,yDAAyD;IACzD,MAAM,WAAW,GAAG,8BAA8B,EAAE,CAAC;IACrD,OAAO,WAAW,EAAE,KAAK,IAAI,KAAK,CAAC;AACrC,CAAC;AAED,eAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED