-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/pn-4727
- Loading branch information
Showing
19 changed files
with
2,112 additions
and
1,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 25 additions & 12 deletions
37
packages/pn-pa-webapp/src/api/statistics/Statistics.api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
import { StatisticsParams, StatisticsResponse } from '../../redux/statistics/types'; | ||
import { StatisticsParams, StatisticsParsedResponse } from '../../models/Statistics'; | ||
import statisticsDataFactoryManager from '../../utility/StatisticsData/StatisticsDataFactoryManager'; | ||
// import { apiClient } from '../apiClients'; | ||
import { statisticsMockResponse } from './statistics.mock'; | ||
|
||
// import { STATISTICS } from './statistics.routes'; | ||
|
||
export const StatisticsApi = { | ||
/** | ||
* Gets current user notifications | ||
* @param {string} startDate | ||
* @param {string} endDate | ||
* @returns Promise | ||
*/ | ||
export /** | ||
* Retrieve statistics data from the backend | ||
* | ||
* @type {{ getStatistics: (params: StatisticsParams<string>) => Promise<StatisticsParsedResponse>; }} | ||
*/ | ||
const StatisticsApi = { | ||
// getStatistics: (params: StatisticsParams<string>): Promise<StatisticsParsedResponse> => | ||
// apiClient.get<StatisticsResponse>(STATISTICS(params)).then((response) => { | ||
// const rawData = response.data; | ||
|
||
// getStatistics: (params: StatisticsParams<string>): Promise<StatisticsResponse> => | ||
// apiClient.get<StatisticsResponse>(STATISTICS(params)).then((response) => response.data), | ||
getStatistics: (params: StatisticsParams<string>): Promise<StatisticsResponse> => | ||
getStatistics: (params: StatisticsParams<string>): Promise<StatisticsParsedResponse> => | ||
new Promise((resolve) => { | ||
console.info(params); | ||
resolve(statisticsMockResponse); | ||
const factory = statisticsDataFactoryManager.factory; | ||
const parsedData = factory.createAll(statisticsMockResponse); | ||
const rawData = statisticsMockResponse; | ||
|
||
resolve({ | ||
sender_id: rawData.sender_id, | ||
genTimestamp: rawData.genTimestamp, | ||
lastDate: rawData.lastDate, | ||
startDate: rawData.startDate, | ||
endDate: rawData.endDate, | ||
data: parsedData, | ||
}); | ||
}), | ||
}; |
Oops, something went wrong.