1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

refactored to match backend

This commit is contained in:
Fedor Katurov 2020-07-12 15:39:09 +07:00
parent 33a55c852d
commit 6b6c7f5dd2
4 changed files with 8 additions and 10 deletions

View file

@ -17,7 +17,7 @@ export const API = {
NODE: { NODE: {
SAVE: '/node/', SAVE: '/node/',
GET: '/node/', GET: '/node/',
GET_DIFF: '/nodes/diff', GET_DIFF: '/flow/diff',
GET_NODE: (id: number | string) => `/node/${id}`, GET_NODE: (id: number | string) => `/node/${id}`,
COMMENT: (id: INode['id']) => `/node/${id}/comment`, COMMENT: (id: INode['id']) => `/node/${id}/comment`,
@ -34,9 +34,9 @@ export const API = {
NODES: '/search/nodes', NODES: '/search/nodes',
}, },
EMBED: { EMBED: {
YOUTUBE: '/embed/youtube', YOUTUBE: '/meta/youtube',
}, },
BORIS: { BORIS: {
GET_BACKEND_STATS: '/stats', GET_BACKEND_STATS: '/stats/',
}, },
}; };

View file

@ -6,6 +6,7 @@ export const ERRORS = {
FILES_REQUIRED: 'Files_Required', FILES_REQUIRED: 'Files_Required',
TEXT_REQUIRED: 'Text_Required', TEXT_REQUIRED: 'Text_Required',
UNKNOWN_NODE_TYPE: 'Unknown_Node_Type', UNKNOWN_NODE_TYPE: 'Unknown_Node_Type',
UNKNOWN_FILE_TYPE: 'Unknown_File_Type',
URL_INVALID: 'Url_Invalid', URL_INVALID: 'Url_Invalid',
FILES_AUDIO_REQUIRED: 'Files_Audio_Required', FILES_AUDIO_REQUIRED: 'Files_Audio_Required',
NOT_ENOUGH_RIGHTS: 'Not_Enough_Rights', NOT_ENOUGH_RIGHTS: 'Not_Enough_Rights',
@ -18,6 +19,7 @@ export const ERRORS = {
DOESNT_MATCH: 'Doesnt_Match', DOESNT_MATCH: 'Doesnt_Match',
REQUIRED: 'Required', REQUIRED: 'Required',
COMMENT_NOT_FOUND: 'Comment_Not_Found', COMMENT_NOT_FOUND: 'Comment_Not_Found',
FILE_IS_TOO_BIG: 'File_Is_Too_Big',
}; };
export const ERROR_LITERAL = { export const ERROR_LITERAL = {
@ -40,4 +42,6 @@ export const ERROR_LITERAL = {
[ERRORS.DOESNT_MATCH]: 'Пароли не совпадают', [ERRORS.DOESNT_MATCH]: 'Пароли не совпадают',
[ERRORS.REQUIRED]: 'Обязательное поле', [ERRORS.REQUIRED]: 'Обязательное поле',
[ERRORS.COMMENT_NOT_FOUND]: 'Комментарий не найден', [ERRORS.COMMENT_NOT_FOUND]: 'Комментарий не найден',
[ERRORS.UNKNOWN_FILE_TYPE]: 'Запрещенный тип файла',
[ERRORS.FILE_IS_TOO_BIG]: 'Файл слишком большой',
}; };

View file

@ -19,13 +19,9 @@ export const URLS = {
export const PRESETS = { export const PRESETS = {
'1600': '1600', '1600': '1600',
'900': '900',
'600': '600', '600': '600',
'300': '300', '300': '300',
'100': '100',
placeholder: 'placeholder',
cover: 'cover', cover: 'cover',
hero: 'hero',
small_hero: 'small_hero', small_hero: 'small_hero',
avatar: 'avatar', avatar: 'avatar',
}; };

View file

@ -66,14 +66,12 @@ function* uploadWorker({ file, temp_id, target, type }: IFileWithUUID) {
yield fork(onUploadProgress, chan); yield fork(onUploadProgress, chan);
const result = yield call(promise, { return yield call(promise, {
temp_id, temp_id,
file, file,
target, target,
type type
}); });
return result;
} }
function* uploadFile({ function* uploadFile({