mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
Fix history render
This commit is contained in:
parent
dec26d64ba
commit
14db85ec5a
@ -252,7 +252,7 @@ export default class RestClient implements Client {
|
||||
revertHistory(id: number, hid: number): Promise<void> {
|
||||
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<ChangeHistory[]> {
|
||||
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<void> {
|
||||
|
@ -99,7 +99,7 @@ const HistoryDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Link
|
||||
href={`c/maps/${mapId}/${row.id}/view`}
|
||||
href={`/c/maps/${mapId}/${row.id}/view`}
|
||||
target="history"
|
||||
>
|
||||
<FormattedMessage
|
||||
|
Loading…
Reference in New Issue
Block a user