summaryrefslogtreecommitdiffstats
path: root/webapp/actions/file_actions.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/actions/file_actions.jsx')
-rw-r--r--webapp/actions/file_actions.jsx13
1 files changed, 13 insertions, 0 deletions
diff --git a/webapp/actions/file_actions.jsx b/webapp/actions/file_actions.jsx
index 628144676..c34af94c4 100644
--- a/webapp/actions/file_actions.jsx
+++ b/webapp/actions/file_actions.jsx
@@ -5,6 +5,7 @@ import store from 'stores/redux_store.jsx';
const dispatch = store.dispatch;
const getState = store.getState;
import {uploadFile as uploadFileRedux} from 'mattermost-redux/actions/files';
+import {Client4} from 'mattermost-redux/client';
export function uploadFile(file, name, channelId, clientId, success, error) {
const fileFormData = new FormData();
@@ -23,3 +24,15 @@ export function uploadFile(file, name, channelId, clientId, success, error) {
}
);
}
+
+export async function getPublicLink(fileId, success) {
+ Client4.getFilePublicLink(fileId).then(
+ (data) => {
+ if (data && success) {
+ success(data.link);
+ }
+ }
+ ).catch(
+ () => {} //eslint-disable-line no-empty-function
+ );
+}