From 9cc37e6918fcbf53744612704ab53bce7290c7fd Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 23 Jan 2017 15:23:14 +0100 Subject: Move instances of Client.uploadFile() in components to an action (#5165) --- webapp/actions/file_actions.jsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 webapp/actions/file_actions.jsx (limited to 'webapp/actions') diff --git a/webapp/actions/file_actions.jsx b/webapp/actions/file_actions.jsx new file mode 100644 index 000000000..0399a2c28 --- /dev/null +++ b/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); + } + } + ); +} -- cgit v1.2.3-1-g7c22