Commit 57495259 authored by Paul Kaplan's avatar Paul Kaplan

Fix lint and remove unused code

parent a97263cb
......@@ -62,19 +62,19 @@ const setFetchStatus = (fetchType, fetchStatus, error) => ({
error
});
const setInfo = (info) => ({
const setInfo = info => ({
type: 'SET_INFO',
info: info
});
const setRoles = (roles) => ({
const setRoles = roles => ({
type: 'SET_ROLES',
roles: roles
});
const getInfo = (studioId) => (dispatch => {
const getInfo = studioId => (dispatch => {
dispatch(setFetchStatus('infoStatus', Status.FETCHING));
api({uri: `/studios/${studioId}`,}, (err, body, res) => {
api({uri: `/studios/${studioId}`}, (err, body, res) => {
if (err || typeof body === 'undefined' || res.statusCode !== 200) {
dispatch(setFetchStatus('infoStatus', Status.ERROR, err));
return;
......@@ -117,4 +117,4 @@ module.exports = {
Status,
getInfo,
getRoles
}
};
const ITEM_LIMIT = 4;
const infoFetcher = studioId => fetch(`${process.env.API_HOST}/studios/${studioId}`)
.then(response => response.json());
const projectFetcher = (studioId, offset) =>
fetch(`${process.env.API_HOST}/studios/${studioId}/projects?limit=${ITEM_LIMIT}&offset=${offset}`)
.then(response => response.json())
......@@ -25,7 +22,6 @@ const activityFetcher = studioId =>
export {
activityFetcher,
infoFetcher,
projectFetcher,
curatorFetcher,
managerFetcher
......
......@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import {useParams} from 'react-router-dom';
import {connect} from 'react-redux';
import Debug from './debug.jsx';
import {Status as SessionStatus} from '../../redux/session';
import {getInfo, getRoles} from '../../redux/studio';
const StudioInfo = ({username, studio, token, onLoadInfo, onLoadRoles}) => {
......@@ -33,11 +32,13 @@ StudioInfo.propTypes = {
token: PropTypes.string,
studio: PropTypes.shape({
// Fill this in as the data is used, just for demo now
})
}),
onLoadInfo: PropTypes.func,
onLoadRoles: PropTypes.func
};
export default connect(
(state) => {
state => {
const user = state.session.session.user;
return {
studio: state.studio,
......@@ -45,8 +46,8 @@ export default connect(
token: user && user.token
};
},
(dispatch) => ({
onLoadInfo: (studioId) => dispatch(getInfo(studioId)),
dispatch => ({
onLoadInfo: studioId => dispatch(getInfo(studioId)),
onLoadRoles: (studioId, username, token) => dispatch(
getRoles(studioId, username, token))
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment