leumas-universal-crud-react
Version:
Leumas Universal CRUD to a dynamic Endpoint, Setup your own Dynamic Endpoint and Use Leumas API to send to your MONGO clusters
29 lines (24 loc) • 1.13 kB
JSX
import React, { useState } from 'react';
import SchemaSelector from './SchemaSelector';
import GetAllByOwner from "../UniversalCrud/GetAllByOwner"
import {useAuthUser} from "react-auth-kit"
import AICard from "../../../components/Cards/AICard"
const Creator = ({setMode}) => {
const [selectedSchema, setSelectedSchema] = useState(''); // State to keep track of selected schema in parent
const auth = useAuthUser();
// Function to handle schema selection
const handleSchemaSelect = (schema) => {
setSelectedSchema(schema);
// Now you can use 'selectedSchema' in your Creator component
// For demonstration:
console.log(`Schema selected in parent: ${schema}`);
};
return (
<div>
{/* <SchemaSelector onSchemaSelect={handleSchemaSelect} /> */}
{/* You can use 'selectedSchema' here if needed */}
<GetAllByOwner setMode={setMode} model={selectedSchema} handleSchemaSelect={handleSchemaSelect} token={auth()?.token} endpoint="LeumasAPI" id={auth()?.id} />
</div>
);
};
export default Creator;