aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/http
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/http')
-rw-r--r--FrontEnd/src/http/timeline.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/FrontEnd/src/http/timeline.ts b/FrontEnd/src/http/timeline.ts
index e95d52a8..37a9ebc9 100644
--- a/FrontEnd/src/http/timeline.ts
+++ b/FrontEnd/src/http/timeline.ts
@@ -6,7 +6,6 @@ import {
axios,
apiBaseUrl,
extractResponseData,
- convertToIfStatusCodeIs,
getHttpToken,
Page,
} from "./common";
@@ -186,8 +185,14 @@ export class HttpTimelineClient implements IHttpTimelineClient {
postTimeline(req: HttpTimelinePostRequest): Promise<HttpTimelineInfo> {
return axios
.post<HttpTimelineInfo>(`${apiBaseUrl}/v2/timelines`, req)
- .then(extractResponseData)
- .catch(convertToIfStatusCodeIs(422, HttpTimelineNameConflictError));
+ .then(extractResponseData, (error: AxiosError) => {
+ const statusCode = error.response?.status;
+ if (statusCode === 422) {
+ throw new HttpTimelineNameConflictError(error);
+ } else {
+ throw error;
+ }
+ });
}
patchTimeline(