Skip to content
Snippets Groups Projects
Commit 9788e696 authored by Daniel Kovacs's avatar Daniel Kovacs
Browse files

asd

parent 11bef317
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,7 @@ app.post('/joinparty/:partyid', (req, res) => {
var config ={
headers: {Authorization: 'Bearer ' + req.body.token}
};
console.log(request.body.token).
let genres = [];
let genres_temp = [];
let trackNum=0;
......@@ -249,10 +250,13 @@ app.post('/saveplaylist/:id', (req,res) => {
axios.post(`https://api.spotify.com/v1/playlists/${playlistId}/tracks?${track_ids}`,{},config).then(result =>{
console.log(result.data)
db.run('DELETE FROM party WHERE id=?',[req.params.id], () => {
console.log("one")
db.run('DELETE FROM songs WHERE party_id=?', [req.params.id],
() => {
console.log("two")
db.run('DELETE FROM party_members WHERE party_id =?',
[req.params.id], () => {
console.log("three")
}
)
})
......
......@@ -79,21 +79,6 @@ export const getPartyDetails = (partyId) => dispatch => {
);
}
export const joinParty = (pData) => dispatch => {
console.log(pData)
axios.post(`https://thespotifierapp.herokuapp.com/joinparty/${pData.party_id}`,pData)
.then(res =>{
console.log(res.data)
}
)
.catch(err=>
dispatch({
type: GET_ERRORS,
payload: err
})
);
}
//ADD PLAYLIST
......
......@@ -42,7 +42,7 @@ class AllProject extends Component {
let playlistContent;
if (this.props.playlists.loading===false && playlists!==null){
if (this.props.playlists.loading===false && playlists!==null && playlists.spotifyPlaylists!==null){
playlistContent=(
playlists.spotifyPlaylists.items.map(playlist => (
<tr key={playlist.name}>
......
import React, { Component, Fragment } from 'react'
import {Link, withRouter} from 'react-router-dom';
import {joinParty} from '../../actions/playlistActions'
import connect from "react-redux/es/connect/connect";
import {getCurrentProfile} from "../../actions/profileActions";
import axios from "axios";
class Join extends Component {
......@@ -15,14 +15,18 @@ class Join extends Component {
this.onSubmit = this.onSubmit.bind(this);
this.state={
profile : null,
token: null
token: null,
joined: false
}
}
onSubmit = param => (e) => {
onSubmit = param => async (e) => {
this.props.joinParty(param, this.props.history);
const response = await axios.post(`https://thespotifierapp.herokuapp.com/joinparty/${param.party_id}`,param)
console.log(response)
this.setState({joined:true})
}
......@@ -50,7 +54,7 @@ class Join extends Component {
return <div className="add-project">
return (!this.state.joined) ? (<div className="add-project">
<div className="containter">
<div className="row">
<div className="col-lg-12">
......@@ -91,7 +95,8 @@ class Join extends Component {
</div>
</div>
</div>
</div>
</div>) : <div className="col-lg-12"> You joined to this event! </div>
}
}
......@@ -101,4 +106,4 @@ const mapStateToProps = state => ({
auth: state.auth
})
export default connect(mapStateToProps,{getCurrentProfile,joinParty})(withRouter(Join));
\ No newline at end of file
export default connect(mapStateToProps,{getCurrentProfile})(withRouter(Join));
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment