From 6b6c7f5dd2f2771e7893839d4e5c090fb3321085 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Sun, 12 Jul 2020 15:39:09 +0700 Subject: [PATCH] refactored to match backend --- src/constants/api.ts | 6 +++--- src/constants/errors.ts | 4 ++++ src/constants/urls.ts | 4 ---- src/redux/uploads/sagas.ts | 4 +--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/constants/api.ts b/src/constants/api.ts index e4b2f40b..0ddd6f62 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -17,7 +17,7 @@ export const API = { NODE: { SAVE: '/node/', GET: '/node/', - GET_DIFF: '/nodes/diff', + GET_DIFF: '/flow/diff', GET_NODE: (id: number | string) => `/node/${id}`, COMMENT: (id: INode['id']) => `/node/${id}/comment`, @@ -34,9 +34,9 @@ export const API = { NODES: '/search/nodes', }, EMBED: { - YOUTUBE: '/embed/youtube', + YOUTUBE: '/meta/youtube', }, BORIS: { - GET_BACKEND_STATS: '/stats', + GET_BACKEND_STATS: '/stats/', }, }; diff --git a/src/constants/errors.ts b/src/constants/errors.ts index e7de2152..6d6d1f3d 100644 --- a/src/constants/errors.ts +++ b/src/constants/errors.ts @@ -6,6 +6,7 @@ export const ERRORS = { FILES_REQUIRED: 'Files_Required', TEXT_REQUIRED: 'Text_Required', UNKNOWN_NODE_TYPE: 'Unknown_Node_Type', + UNKNOWN_FILE_TYPE: 'Unknown_File_Type', URL_INVALID: 'Url_Invalid', FILES_AUDIO_REQUIRED: 'Files_Audio_Required', NOT_ENOUGH_RIGHTS: 'Not_Enough_Rights', @@ -18,6 +19,7 @@ export const ERRORS = { DOESNT_MATCH: 'Doesnt_Match', REQUIRED: 'Required', COMMENT_NOT_FOUND: 'Comment_Not_Found', + FILE_IS_TOO_BIG: 'File_Is_Too_Big', }; export const ERROR_LITERAL = { @@ -40,4 +42,6 @@ export const ERROR_LITERAL = { [ERRORS.DOESNT_MATCH]: 'Пароли не совпадают', [ERRORS.REQUIRED]: 'Обязательное поле', [ERRORS.COMMENT_NOT_FOUND]: 'Комментарий не найден', + [ERRORS.UNKNOWN_FILE_TYPE]: 'Запрещенный тип файла', + [ERRORS.FILE_IS_TOO_BIG]: 'Файл слишком большой', }; diff --git a/src/constants/urls.ts b/src/constants/urls.ts index db07a4ce..055bc214 100644 --- a/src/constants/urls.ts +++ b/src/constants/urls.ts @@ -19,13 +19,9 @@ export const URLS = { export const PRESETS = { '1600': '1600', - '900': '900', '600': '600', '300': '300', - '100': '100', - placeholder: 'placeholder', cover: 'cover', - hero: 'hero', small_hero: 'small_hero', avatar: 'avatar', }; diff --git a/src/redux/uploads/sagas.ts b/src/redux/uploads/sagas.ts index c03474d3..21cbba33 100644 --- a/src/redux/uploads/sagas.ts +++ b/src/redux/uploads/sagas.ts @@ -66,14 +66,12 @@ function* uploadWorker({ file, temp_id, target, type }: IFileWithUUID) { yield fork(onUploadProgress, chan); - const result = yield call(promise, { + return yield call(promise, { temp_id, file, target, type }); - - return result; } function* uploadFile({