summaryrefslogtreecommitdiffstats
path: root/webapp/actions/file_actions.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-06-26 08:16:57 -0400
committerGitHub <noreply@github.com>2017-06-26 08:16:57 -0400
commit23ccfc845ca2350075f6027e16c6206fc7b71716 (patch)
tree3fd1f896a5a24b43913be03b21c85638dd7c356e /webapp/actions/file_actions.jsx
parentfe7e9d95b30ae2195fcba68db960866db91ce045 (diff)
downloadchat-23ccfc845ca2350075f6027e16c6206fc7b71716.tar.gz
chat-23ccfc845ca2350075f6027e16c6206fc7b71716.tar.bz2
chat-23ccfc845ca2350075f6027e16c6206fc7b71716.zip
Move remaining actions over to use redux and v4 endpoints (#6720)
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
+ );
+}