fix(tabsContext.tsx): remove console.log statements for debugging
feat(market-card.tsx): add success alert when flow is installed
This commit is contained in:
parent
6d5c803c17
commit
fd4aa3648a
2 changed files with 7 additions and 4 deletions
|
|
@ -171,12 +171,10 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
});
|
||||
setData((prev) => {
|
||||
let newData = _.cloneDeep(prev);
|
||||
console.log(newData["custom_components"]);
|
||||
console.log(storeComponents);
|
||||
|
||||
const customComponent = newData["custom_components"]["CustomComponent"];
|
||||
newData["custom_components"] = cloneDeep(storeComponents);
|
||||
newData["custom_components"]["CustomComponent"] = customComponent;
|
||||
console.log(newData["custom_components"]);
|
||||
return newData;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
CardHeader,
|
||||
CardTitle,
|
||||
} from "../../../components/ui/card";
|
||||
import { alertContext } from "../../../contexts/alertContext";
|
||||
import { StoreContext } from "../../../contexts/storeContext";
|
||||
import { TabsContext } from "../../../contexts/tabsContext";
|
||||
import { getComponent, saveFlowStore } from "../../../controllers/API";
|
||||
|
|
@ -22,6 +23,7 @@ export const MarketCardComponent = ({ data }: { data: FlowComponent }) => {
|
|||
const [added, setAdded] = useState(savedFlows.has(data.id) ? true : false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { addFlow } = useContext(TabsContext);
|
||||
const { setSuccessData } = useContext(alertContext);
|
||||
const flowData = useRef<FlowType>();
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -53,13 +55,16 @@ export const MarketCardComponent = ({ data }: { data: FlowComponent }) => {
|
|||
|
||||
function handleInstall() {
|
||||
if (flowData.current) {
|
||||
addFlow(true, flowData.current!);
|
||||
addFlow(true, flowData.current!).then(() => {
|
||||
setSuccessData({ title: "Flow Installed" });
|
||||
});
|
||||
} else {
|
||||
getComponent(data.id).then((res) => {
|
||||
console.log(res);
|
||||
const newFLow = cloneFLowWithParent(res, res.id, data.is_component);
|
||||
flowData.current = newFLow;
|
||||
addFlow(true, newFLow);
|
||||
setSuccessData({ title: "Flow Installed" });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue