Move instances of Client.uploadFile() in components to an action (#5165)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
dbfd93daa7
Коммит
9cc37e6918
26
webapp/actions/file_actions.jsx
Обычный файл
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);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
Ссылка в новой задаче
Block a user