summaryrefslogtreecommitdiffstats
path: root/webapp/actions/file_actions.jsx
blob: 204f452d824f2bf40b5c600e483e64750cfce1bb (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-present 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);
            }
        }
    );
}