Skip to content
Snippets Groups Projects

edit global Windoes interface to be compiled by typescript

+ 8
1
import { loadPolicy } from "@open-policy-agent/opa-wasm";
declare global {
interface Window {
__env__: {
OPA_BUNDLE_URL?: string;
};
}
}
export async function createPolicyCheck(user?: Partial<Oidc.Profile>) {
if (!user) {
return () => true;
}
const opaBundletUrl = window.__env__.OPA_BUNDLE_URL;
const opaBundletUrl = window.__env__?.OPA_BUNDLE_URL;
if (typeof opaBundletUrl === 'undefined') {
console.log('OPA_BUNDLE_URL is not defined');
Loading