diff --git a/packages/webapp/src/client/rest-client/index.ts b/packages/webapp/src/client/rest-client/index.ts index 32b117ea..5d0b2229 100644 --- a/packages/webapp/src/client/rest-client/index.ts +++ b/packages/webapp/src/client/rest-client/index.ts @@ -34,8 +34,7 @@ export default class RestClient implements Client { // All was ok, let's sent to success page ...; success(); }).catch(error => { - const response = error.response; - const errorInfo = this.parseResponseOnError(response); + const errorInfo = this.parseResponseOnError(error.response); reject(errorInfo); }); } @@ -62,7 +61,25 @@ export default class RestClient implements Client { } renameMap(id: number, basicInfo: BasicMapInfo): Promise { - throw "Method not implemented yet"; + const handler = (success: () => void, reject: (error: ErrorInfo) => void) => { + axios.put(`${this.baseUrl}/c/restful/maps/${id}/title`, + basicInfo.title, + { headers: { 'Content-Type': 'text/plain' } } + ).then(() => { + return axios.put(`${this.baseUrl}/c/restful/maps/${id}/description`, + basicInfo.description, + { headers: { 'Content-Type': 'text/plain' } } + ) + }).then(() => { + // All was ok, let's sent to success page ...; + success(); + }).catch(error => { + const response = error.response; + const errorInfo = this.parseResponseOnError(response); + reject(errorInfo); + }); + } + return new Promise(handler); } createMap(model: BasicMapInfo): Promise { @@ -254,7 +271,7 @@ export default class RestClient implements Client { case 401: case 302: this.sessionExpired(); - result = { msg: "Your current session has expired. Please, sign in and try again." }; + result = { msg: "Your current session has expired. Please, sign in and try again." }; break; default: if (data) {