diff --git a/packages/webapp/src/classes/client/rest-client/index.ts b/packages/webapp/src/classes/client/rest-client/index.ts index 7632ebe6..9b79a148 100644 --- a/packages/webapp/src/classes/client/rest-client/index.ts +++ b/packages/webapp/src/classes/client/rest-client/index.ts @@ -252,7 +252,7 @@ export default class RestClient implements Client { revertHistory(id: number, hid: number): Promise { const handler = (success: () => void, reject: (error: ErrorInfo) => void) => { axios - .post(`${this.baseUrl}/maps/${id}/history/${hid}`, null, { + .post(`${this.baseUrl}/c/restful/maps/${id}/history/${hid}`, null, { headers: { 'Content-Type': 'text/pain' }, }) .then(() => { @@ -267,7 +267,31 @@ export default class RestClient implements Client { } fetchHistory(id: number): Promise { - throw new Error(`Method not implemented. ${id}`); + const handler = ( + success: (historyList: ChangeHistory[]) => void, + reject: (error: ErrorInfo) => void + ) => { + axios + .get(`${this.baseUrl}/c/restful/maps/${id}/history/`, { + headers: { 'Content-Type': 'application/json' }, + }) + .then((response) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const historyList: ChangeHistory[] = (response.data.changes as any[]).map((h) => { + return { + id: h.id, + lastModificationBy: h.creator, + lastModificationTime: h.creationTime, + }; + }); + success(historyList); + }) + .catch((error) => { + const errorInfo = this.parseResponseOnError(error.response); + reject(errorInfo); + }); + }; + return new Promise(handler); } renameMap(id: number, basicInfo: BasicMapInfo): Promise { diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/history-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/history-dialog/index.tsx index 0993ebc4..11c9ebd3 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/history-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/history-dialog/index.tsx @@ -99,7 +99,7 @@ const HistoryDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen