summaryrefslogtreecommitdiffstats
path: root/webapp/actions/file_actions.jsx
blob: 0399a2c285604c14994f8aa5073b2c63d1754d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
            }
        }
    );
}