mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
fixing imports and ssr support + updated remix/nextjs/astro examples
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
//import { notifications } from "@mantine/notifications";
|
||||
import { getDefaultConfig, getDefaultSchema } from "modules/ModuleManager";
|
||||
import { createContext, startTransition, useContext, useEffect, useRef, useState } from "react";
|
||||
import type { ModuleConfigs, ModuleSchemas } from "../../modules";
|
||||
@@ -101,20 +100,6 @@ export function BkndProvider({
|
||||
);
|
||||
}
|
||||
|
||||
type BkndWindowContext = {
|
||||
user?: object;
|
||||
logout_route: string;
|
||||
};
|
||||
export function useBkndWindowContext(): BkndWindowContext {
|
||||
if (typeof window !== "undefined" && window.__BKND__) {
|
||||
return window.__BKND__ as any;
|
||||
} else {
|
||||
return {
|
||||
logout_route: "/api/auth/logout"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function useBknd({ withSecrets }: { withSecrets?: boolean } = {}): BkndContext {
|
||||
const ctx = useContext(BkndContext);
|
||||
if (withSecrets) ctx.requireSecrets();
|
||||
|
||||
Reference in New Issue
Block a user