Skip to content
Snippets Groups Projects
Commit 5290a795 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Updates from review - tidying

parent 7bfffb79
No related branches found
No related tags found
No related merge requests found
import { apiFetch } from '@api/utils'; import { apiFetch } from '@api/utils';
export async function fetchRound(id) { export function fetchRound(id) {
return apiFetch(`/apply/api/rounds/${id}`, 'GET'); return apiFetch(`/apply/api/rounds/${id}/`, 'GET');
} }
...@@ -92,7 +92,7 @@ export default class GroupedListing extends React.Component { ...@@ -92,7 +92,7 @@ export default class GroupedListing extends React.Component {
const orderedItems = order.map(({key, display, values}) => ({ const orderedItems = order.map(({key, display, values}) => ({
name: display, name: display,
key: key, key,
items: values.reduce((acc, value) => acc.concat(groupedItems[value] || []), []) items: values.reduce((acc, value) => acc.concat(groupedItems[value] || []), [])
})) }))
......
...@@ -72,7 +72,7 @@ export const fetchRound = roundID => { ...@@ -72,7 +72,7 @@ export const fetchRound = roundID => {
if (response.ok) { if (response.ok) {
dispatch(updateRound(roundID, json)); dispatch(updateRound(roundID, json));
} else { } else {
dispatch(failLoadingRound(json.meta.error)); dispatch(failLoadingRound(json.detail));
} }
} catch (e) { } catch (e) {
dispatch(failLoadingRound(e.message)); dispatch(failLoadingRound(e.message));
...@@ -110,7 +110,7 @@ export const fetchSubmissionsByRound = roundID => { ...@@ -110,7 +110,7 @@ export const fetchSubmissionsByRound = roundID => {
if (response.ok) { if (response.ok) {
dispatch(updateSubmissionsByRound(roundID, json)); dispatch(updateSubmissionsByRound(roundID, json));
} else { } else {
dispatch(failLoadingSubmissionsByRound(json.meta.error)); dispatch(failLoadingSubmissionsByRound(json.detail));
} }
} catch (e) { } catch (e) {
dispatch(failLoadingSubmissionsByRound(e.message)); dispatch(failLoadingSubmissionsByRound(e.message));
...@@ -149,7 +149,7 @@ export const loadCurrentSubmission = (requiredFields=[]) => (dispatch, getState) ...@@ -149,7 +149,7 @@ export const loadCurrentSubmission = (requiredFields=[]) => (dispatch, getState)
return null return null
} }
return dispatch(fetchSubmission(getCurrentSubmissionID(getState()))) return dispatch(fetchSubmission(submissionID))
} }
...@@ -163,7 +163,7 @@ export const fetchSubmission = submissionID => { ...@@ -163,7 +163,7 @@ export const fetchSubmission = submissionID => {
if (response.ok) { if (response.ok) {
dispatch(updateSubmission(submissionID, json)); dispatch(updateSubmission(submissionID, json));
} else { } else {
dispatch(failLoadingSubmission(json.meta.error)); dispatch(failLoadingSubmission(json.detail));
} }
} catch (e) { } catch (e) {
dispatch(failLoadingSubmission(e.message)); dispatch(failLoadingSubmission(e.message));
......
...@@ -16,7 +16,7 @@ const getCurrentRound = createSelector( ...@@ -16,7 +16,7 @@ const getCurrentRound = createSelector(
const getCurrentSubmissionID = state => state.submissions.current; const getCurrentSubmissionID = state => state.submissions.current;
const getCurrentRoundSubmissionIDs = createSelector( const getCurrentRoundSubmissionIDs = createSelector(
[ getCurrentRound, getSubmissions], [ getCurrentRound ],
(round) => { (round) => {
return round ? round.submissions.ids : []; return round ? round.submissions.ids : [];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment