import React, {useState, useEffect} from 'react'; import {Link} from 'react-router-dom'; import {Provider, connect} from 'react-redux'; import { actionUsersPlaylists } from '../store/promiseReducer'; import { actionFullSetPlaylist } from '../store/playerReducer'; import { store } from '../store/store'; import image from '../images/card.png'; import Modal from 'react-bootstrap/Modal'; import Button from 'react-bootstrap/Button'; import {CreatePlaylist} from './createPlaylist' import { Header } from './header'; // function sendForm (url, data) { // fetch(`http://player-api/api/${url}`, { // method: 'POST', // body: data, // headers: { // ...(localStorage.authToken ? {"Authorization": "Bearer " + localStorage.authToken} : {}) // }, // }).then(res => res.json()) // .then(data => { // if(data.token) { // console.log(data) // return data // } else { // //console.log(data.login[0]); // } // }) // } const Playlist = ({playlist: {id, user_id, name, photo, description} = {}}) =>
store.dispatch(actionFullSetPlaylist({id, user_id, name, photo, description}) )}> ...
{name}

{description? description : '.' }

export const UsersPlaylistsAll = ({playlists= []}) =>
{playlists.map((playlist, i) => )}
const СUsersPlaylists = connect(state => ({playlists: state.promise.usersPlaylists?.payload?.playlists|| []}), )(UsersPlaylistsAll); function MyVerticallyCenteredModal(props) { return ( {/* */} {/* Create new Playlist */} {/* */} {/* */} ); } export const UserPage = () => { let id = store.getState().auth.user.id; const getAnswer = async () => { await store.dispatch(actionUsersPlaylists(id)); }; useEffect(() => { getAnswer(); }, []); const [modalShow, setModalShow] = React.useState(false); return(<>
...

{store.getState().auth.user.name}

Edit Profile
setModalShow(false)} />

My playlists:

<СUsersPlaylists/> ) }