From 922531b6d6623ae02ae774ead2f0e4de8b159611 Mon Sep 17 00:00:00 2001 From: Lukas Brabec Date: Apr 02 2020 08:35:20 +0000 Subject: some small fixes --- diff --git a/src/actions/reduxActions.js b/src/actions/reduxActions.js index dc5e54c..10a9e9a 100644 --- a/src/actions/reduxActions.js +++ b/src/actions/reduxActions.js @@ -47,7 +47,7 @@ export const moveIssue = payload => dispatch => { payload: payload }); - fetch(window.env.API + 'kanban/move_issue', { + fetch(window.env.API + 'kanban/move_issue?access_token=' + payload.access_token, { method: 'POST', credentials: 'include', headers: { @@ -57,11 +57,11 @@ export const moveIssue = payload => dispatch => { }) .then((response) => response.json()) .then((data) => { - //console.log('Success:', data); + console.log('Success:', data); dispatch(moveIssueResp(data)) }) .catch((error) => { - //console.error('Error:', error); + console.error('Error:', error); dispatch(moveIssueResp({ ...payload, new_stage: payload['old_stage'] @@ -73,11 +73,3 @@ export const saveToken = payload => ({ type: ActionTypes.SAVE_TOKEN, payload: payload }) - -export const tokenTest = payload => dispatch => { - fetch(window.env.API + 'secret_test?access_token=' + payload) - .then(blob => blob.json) - .then(data => { - console.log(data) - }) -} diff --git a/src/components/board.js b/src/components/board.js index a93cc23..474bfcf 100644 --- a/src/components/board.js +++ b/src/components/board.js @@ -37,11 +37,13 @@ class Board extends Component { // dropping to different list const issue_id = this.props.stages[source.droppableId][source.index].id + console.log('moving issue with token ' + this.props.token) this.props.dispatch(moveIssue({ 'project': this.props.projectName, 'issue_id': issue_id, 'new_stage': destination.droppableId, - 'old_stage': source.droppableId + 'old_stage': source.droppableId, + 'access_token': this.props.token })) } @@ -67,7 +69,7 @@ class Board extends Component { } const mapStateToProps = (state, ownProps) => { - const { projects, user } = state + const { projects, user, token } = state const project = projects[ownProps.projectName] return { @@ -75,7 +77,8 @@ const mapStateToProps = (state, ownProps) => { stages: Object.fromEntries(project.stages.map(stageName => [stageName, project.issues.filter(issue => issue.stage === stageName)] )), - user + user, + token } } diff --git a/src/components/sidebar.js b/src/components/sidebar.js index 500d043..c6c3c5b 100644 --- a/src/components/sidebar.js +++ b/src/components/sidebar.js @@ -4,7 +4,8 @@ import { connect } from 'react-redux' class LoginButton extends Component { render() { - if(!this.props.user.is_authenticated) { + const { token, user } = this.props + if(token==="" || !user.is_authenticated) { return (
@@ -25,17 +26,9 @@ class LoginButton extends Component { } } -const doit = (payload) => { - fetch(window.env.API + 'secret_test?access_token=' + payload) - .then(blob => blob.json()) - .then(data => { - console.log(data) - }) -} - class Sidebar extends Component { render() { - const { projects, selectedProjectName, user } = this.props + const { projects, selectedProjectName, user, token } = this.props const style = projectName => "sidebarItem " + (projectName===selectedProjectName? "selected" : "") return ( @@ -50,11 +43,8 @@ class Sidebar extends Component {
))} -
doit(this.props.token)}> - tokentest -
- +
)