Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove assignments endpoint since it no longer exists #505

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/actions/userProfilePublic.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ export function userProfilePublicFetchData(id, bypass) {
// profile
const getUserAccount = () => api().get(`/client/${id}/`);

// assignments
const getUserAssignments = () => api().get(`/client/${id}/assignments/`);

// bids
const getUserBids = () => api().get(`/client/${id}/bids/`);

// use api' Promise.all to fetch the profile, assignments and any other requests we
// might add in the future
axios.all([getUserAccount(), getUserAssignments(), getUserBids()])
.then(axios.spread((acct, assignments, bids) => {
axios.all([getUserAccount(), getUserBids()])
.then(axios.spread((acct, bids) => {
// form the userProfile object
if (!get(acct, 'data.id')) {
dispatch(userProfilePublicHasErrored(true));
Expand All @@ -61,7 +58,7 @@ export function userProfilePublicFetchData(id, bypass) {
const account = acct.data;
const newProfileObject = {
...account,
assignments: get(assignments, 'data.results', []),
assignments: [],
bidList: get(bids, 'data.results', []),
// any other profile info we want to add in the future
};
Expand Down
15 changes: 0 additions & 15 deletions src/actions/userProfilePublic.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { setupAsyncMocks } from '../testUtilities/testUtilities';
import * as actions from './userProfilePublic';
import assignmentObject from '../__mocks__/assignmentObject';
import bidListObject from '../__mocks__/bidListObject';

const { mockStore, mockAdapter } = setupAsyncMocks();
Expand All @@ -19,8 +18,6 @@ describe('async actions', () => {
received_shares: [],
};

const assignments = [assignmentObject];

const bids = bidListObject;

// reset the mockAdapter since we repeat specific requests
Expand All @@ -35,10 +32,6 @@ describe('async actions', () => {
profile,
);

mockAdapter.onGet('http://localhost:8000/api/v1/client/1/assignments/').reply(200,
{ results: assignments },
);

mockAdapter.onGet('http://localhost:8000/api/v1/client/1/bids/').reply(200,
{ results: bids },
);
Expand All @@ -59,10 +52,6 @@ describe('async actions', () => {
{ ...profile, id: null },
);

mockAdapter.onGet('http://localhost:8000/api/v1/client/1/assignments/').reply(200,
{ results: assignments },
);

mockAdapter.onGet('http://localhost:8000/api/v1/client/1/bids/').reply(200,
{ results: bids },
);
Expand All @@ -85,10 +74,6 @@ describe('async actions', () => {
{},
);

mockAdapter.onGet('http://localhost:8000/api/v1/client/1/assignments/').reply(404,
{},
);

mockAdapter.onGet('http://localhost:8000/api/v1/client/1/bids/').reply(404,
{},
);
Expand Down