import React, {useState} from 'react'; import { sendForm } from './SendForm'; import Modal from 'react-bootstrap/Modal'; import Button from 'react-bootstrap/Button'; import { actionUsersPlaylists } from '../store/promiseReducer'; import { store } from '../store/store'; import { history } from '../App'; export const CreatePlaylist = (props) => { const [name, setName] = useState(''); const [description, setDescription] = useState(''); const [privat, setPrivat] = useState(0); const [image, setImage] = useState(null); const PostCreatePlaylist = async(event) =>{ event.preventDefault(); const data = new FormData(); data.append("name", name); description && data.append("description", description); data.append("private", privat); image && data.append("photo", image, image.name); let result = await sendForm('playlists/create', data); console.log(result); store.dispatch(actionUsersPlaylists(store.getState().auth?.user?.id)); //history.push(`/playlist/${result.playlist.id}`) } return <> Create new Playlist
{/*
*/}
setImage(e.target.files[0])} multiple={false}/> setPrivat(e.target.checked? 1 : 0)}/>

setName(e.target.value)}/>