Commit 03a99107 authored by Matija Obreza's avatar Matija Obreza

Merge branch '699-country-names-missing'

* 699-country-names-missing:
  Fix: Country names missing
parents 19aa9d0c 484607ee
......@@ -2,7 +2,6 @@ import update from 'immutability-helper';
import { IReducerAction } from 'model/common.model';
import Page from 'model/Page';
import FilteredPage from 'model/FilteredPage';
import FaoInstitute from 'model/genesys/FaoInstitute';
import {
RECEIVE_PARTNER,
......@@ -10,7 +9,6 @@ import {
RECEIVE_PARTNER_INSTITUTES,
UPDATE_PARTNER_INSTITUTES,
} from 'partners/constants';
import { dereferenceReferences2 } from 'utilities';
const INITIAL_STATE = {
currentPartner: null,
......@@ -37,10 +35,6 @@ export default (state = INITIAL_STATE, action: IReducerAction = {type: ''}) => {
});
}
if (apiCall.data && apiCall.data.content && apiCall.data.content.length > 0) {
dereferenceReferences2(apiCall.data.content, FaoInstitute.DEREFERENCES);
}
return update(state, {
partnerInstitutes: {
data: { $set: Page.merge(state.partnerInstitutes && state.partnerInstitutes.data, apiCall.data) },
......@@ -67,10 +61,6 @@ export default (state = INITIAL_STATE, action: IReducerAction = {type: ''}) => {
const {apiCall: {loading, error, timestamp, data}, uuid} = action.payload;
if (state.currentPartner && state.currentPartner.data && state.currentPartner.data.uuid === uuid) {
if (data) {
dereferenceReferences2(data.content, FaoInstitute.DEREFERENCES);
}
return update(state, {
partnerInstitutes: {
$set: {
......
......@@ -2,6 +2,7 @@
import * as UrlTemplate from 'url-template';
import * as QueryString from 'query-string';
import { axiosBackend } from 'utilities/requestUtils';
import { dereferenceReferences2 } from 'utilities';
import FilteredPage from 'model/FilteredPage';
import Page, { IPageRequest } from 'model/Page';
......@@ -242,7 +243,11 @@ class PartnerService {
url: apiUrl,
method: 'POST',
...content,
}).then(({ data }) => data as Page<FaoInstitute>);
}).then(({ data }) => data as Page<FaoInstitute>)
.then((data) => {
dereferenceReferences2(data.content, FaoInstitute.DEREFERENCES);
return data;
});
}
}
......
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