Skip to content

Commit

Permalink
Support apiUrl override
Browse files Browse the repository at this point in the history
  • Loading branch information
bpapillon committed Jan 25, 2024
1 parent b2c17a2 commit cf4179e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"test": "jest --config jest.config.js"
},
"types": "dist/schematic-react.d.ts",
"version": "0.1.3",
"version": "0.1.4",
"dependencies": {
"@schematichq/schematic-js": "^0.1.3"
"@schematichq/schematic-js": "^0.1.4"
},
"peerDependencies": {
"react": ">=18"
Expand Down
5 changes: 4 additions & 1 deletion react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface SchematicFlags {
interface SchematicProviderProps {
children: ReactNode;
publishableKey?: string;
apiUrl?: string;
}

interface SchematicContextProps {
Expand All @@ -26,8 +27,9 @@ const SchematicContext = createContext<SchematicContextProps>({
});

const SchematicProvider: React.FC<SchematicProviderProps> = ({
publishableKey,
apiUrl,
children,
publishableKey,
}) => {
const [client, setClient] = useState<SchematicJS.Schematic | undefined>();
const [flagValues, setFlagValues] = useState<Record<string, boolean>>({});
Expand All @@ -38,6 +40,7 @@ const SchematicProvider: React.FC<SchematicProviderProps> = ({
}

const client = new SchematicJS.Schematic(publishableKey, {
apiUrl,
flagListener: setFlagValues,
useWebSocket: true,
});
Expand Down

0 comments on commit cf4179e

Please sign in to comment.