Skip to content

Commit

Permalink
fix: put request in util/requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Dec 21, 2023
1 parent eb7d9aa commit 7711383
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/actions/map.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import log from 'loglevel';
import * as types from '../constants/actionTypes';
import { getFallbackBasemap } from '../constants/basemaps';
import { dataStatisticsMutation } from '../util/apiDataStatistics.js';
import { fetchMap } from '../util/requests';
import { fetchMap, dataStatisticsMutation } from '../util/requests';
import { addOrgUnitPaths } from '../util/helpers';
import { loadLayer } from './layers';

Expand Down
3 changes: 1 addition & 2 deletions src/components/app/FileMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { useD2 } from '@dhis2/app-runtime-adapter-d2';
import { useDataMutation, useDataEngine } from '@dhis2/app-runtime';
import { newMap, tOpenMap, setMapProps } from '../../actions/map';
import { setAlert } from '../../actions/alerts';
import { dataStatisticsMutation } from '../../util/apiDataStatistics.js';
import { fetchMap } from '../../util/requests';
import { fetchMap, dataStatisticsMutation } from '../../util/requests';
import { cleanMapConfig } from '../../util/favorites';
import { useSystemSettings } from '../SystemSettingsProvider';

Expand Down
8 changes: 0 additions & 8 deletions src/util/apiDataStatisitcs.js

This file was deleted.

9 changes: 9 additions & 0 deletions src/util/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export const fetchMap = async (id, engine, keyDefaultBaseMap) =>
// },
// };

export const dataStatisticsMutation = {
resource: 'dataStatistics',
params: ({ id }) => ({
favorite: id,
eventType: 'MAP_VIEW',
}),
type: 'create',
};

export const fetchOrgUnits = async () => {
// TODO - use d2 until correct dataQuery format can be determined
const d2 = await getD2();
Expand Down

0 comments on commit 7711383

Please sign in to comment.