mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Complete duplicate action for rest.
This commit is contained in:
parent
86d78935f0
commit
0d7cf3e5b1
@ -160,5 +160,23 @@ export default class RestClient extends MockClient {
|
|||||||
}
|
}
|
||||||
return new Promise(handler);
|
return new Promise(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicateMap(id: number, basicInfo: BasicMapInfo): Promise<number> {
|
||||||
|
|
||||||
|
const handler = (success: (mapId: number) => void, reject: (error: ErrorInfo) => void) => {
|
||||||
|
axios.post(this.baseUrl + `/c/restful/maps/${id}`,
|
||||||
|
JSON.stringify(basicInfo),
|
||||||
|
{ headers: { 'Content-Type': 'application/json' } }
|
||||||
|
).then(response => {
|
||||||
|
const mapId = response.headers.resourceid;
|
||||||
|
success(mapId);
|
||||||
|
}).catch(error => {
|
||||||
|
const response = error.response;
|
||||||
|
const errorInfo = this.parseResponseOnError(response);
|
||||||
|
reject(errorInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return new Promise(handler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ const DuplicateDialog = (props: DialogProps) => {
|
|||||||
return service.duplicateMap(id, rest);
|
return service.duplicateMap(id, rest);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: (mapId) => {
|
||||||
handleOnMutationSuccess(props.onClose, queryClient);
|
window.location.href = `/c/maps/${mapId}/edit`;
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
setError(error);
|
setError(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user