Move instances of Client.uploadFile() in components to an action (#5165)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2017-01-23 15:23:14 +01:00
коммит произвёл Joram Wilander
родитель dbfd93daa7
Коммит 9cc37e6918
2 изменённых файлов: 38 добавлений и 9 удалений

26
webapp/actions/file_actions.jsx Обычный файл
Просмотреть файл

@@ -0,0 +1,26 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as AsyncClient from 'utils/async_client.jsx';
import Client from 'client/web_client.jsx';
export function uploadFile(file, name, channelId, clientId, success, error) {
Client.uploadFile(
file,
name,
channelId,
clientId,
(data) => {
if (success) {
success(data);
}
},
(err) => {
AsyncClient.dispatchError(err, 'uploadFile');
if (error) {
error(err);
}
}
);
}