Skip to content

Commit

Permalink
update response type
Browse files Browse the repository at this point in the history
  • Loading branch information
Zasa-san committed Jan 17, 2025
1 parent cb403f7 commit 1450ff2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/react/V2/api/translations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Params } from 'react-router-dom';
import { IncomingHttpHeaders } from 'http';
import api from 'app/utils/api';
import { I18NApi } from 'app/I18N';
import { FetchResponseError } from 'shared/JSONRequest';
import { ClientTranslationSchema, ClientTranslationContextSchema } from 'app/istore';
import { RequestParams } from 'app/utils/RequestParams';
import { TranslationValue } from 'V2/shared/types';
Expand Down Expand Up @@ -53,15 +54,15 @@ const postV2 = async (
updatedTranslations: TranslationValue[],
context: ClientTranslationContextSchema,
headers?: IncomingHttpHeaders
): Promise<ClientTranslationSchema[]> => {
): Promise<number | FetchResponseError> => {
try {
const translations = updatedTranslations.map(ut => ({
...ut,
context: { id: context.id, label: context.label, type: context.type },
}));
const params = new RequestParams(translations, headers);
const response = await api.post('translationsV2', params);
return response.status.ok;
return response.status;
} catch (e) {
return e;
}
Expand Down

0 comments on commit 1450ff2

Please sign in to comment.