diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-01-23 15:23:14 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-01-23 09:23:14 -0500 |
commit | 9cc37e6918fcbf53744612704ab53bce7290c7fd (patch) | |
tree | 6dcf538ba4af2988b0cd9b4aa9df3c64fb30af78 /webapp/actions | |
parent | dbfd93daa75a0998bc8645245f9cc1ad77f3cadd (diff) | |
download | chat-9cc37e6918fcbf53744612704ab53bce7290c7fd.tar.gz chat-9cc37e6918fcbf53744612704ab53bce7290c7fd.tar.bz2 chat-9cc37e6918fcbf53744612704ab53bce7290c7fd.zip |
Move instances of Client.uploadFile() in components to an action (#5165)
Diffstat (limited to 'webapp/actions')
-rw-r--r-- | webapp/actions/file_actions.jsx | 26 |
1 files changed, 26 insertions, 0 deletions
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); + } + } + ); +} |