import React, { useState } from "react"; import { useDispatch } from "react-redux"; import { setProject } from "../../../redux/projectsTrackerSlice"; import {apiRequest} from "../../../api/request"; import "./ModalCreate.scss"; export const ModalCreate = ({ active, setActive, title }) => { const [inputValue, setInputValue] = useState(""); const dispatch = useDispatch(); function createName() { if (inputValue === "") { return; } else { apiRequest('/project/create', { method: 'POST', data: { user_id: localStorage.getItem('id'), name: inputValue, status: 1, } }).then((res) => { dispatch(setProject(res)); setActive(false); setInputValue(""); }) } } return (