From 23ccfc845ca2350075f6027e16c6206fc7b71716 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Mon, 26 Jun 2017 08:16:57 -0400
Subject: Move remaining actions over to use redux and v4 endpoints (#6720)

---
 webapp/actions/admin_actions.jsx | 51 +++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 21 deletions(-)

(limited to 'webapp/actions/admin_actions.jsx')

diff --git a/webapp/actions/admin_actions.jsx b/webapp/actions/admin_actions.jsx
index b9580c746..fdaeb8732 100644
--- a/webapp/actions/admin_actions.jsx
+++ b/webapp/actions/admin_actions.jsx
@@ -3,8 +3,6 @@
 
 import {clientLogout} from 'actions/global_actions.jsx';
 
-import Client from 'client/web_client.jsx';
-
 import store from 'stores/redux_store.jsx';
 const dispatch = store.dispatch;
 const getState = store.getState;
@@ -267,31 +265,26 @@ export function uploadBrandImage(brandImage, success, error) {
 }
 
 export function uploadLicenseFile(file, success, error) {
-    Client.uploadLicenseFile(
-        file,
-        () => {
-            if (success) {
-                success();
-            }
-        },
-        (err) => {
-            if (error) {
-                error(err);
+    AdminActions.uploadLicense(file)(dispatch, getState).then(
+        (data) => {
+            if (data && success) {
+                success(data);
+            } else if (data == null && error) {
+                const serverError = getState().requests.admin.uploadLicense.error;
+                error({id: serverError.server_error_id, ...serverError});
             }
         }
     );
 }
 
 export function removeLicenseFile(success, error) {
-    Client.removeLicenseFile(
-        () => {
-            if (success) {
-                success();
-            }
-        },
-        (err) => {
-            if (error) {
-                error(err);
+    AdminActions.removeLicense()(dispatch, getState).then(
+        (data) => {
+            if (data && success) {
+                success(data);
+            } else if (data == null && error) {
+                const serverError = getState().requests.admin.removeLicense.error;
+                error({id: serverError.server_error_id, ...serverError});
             }
         }
     );
@@ -374,3 +367,19 @@ export function removeIdpSamlCertificate(success, error) {
         }
     );
 }
+
+export function getStandardAnalytics(teamId) {
+    AdminActions.getStandardAnalytics(teamId)(dispatch, getState);
+}
+
+export function getAdvancedAnalytics(teamId) {
+    AdminActions.getAdvancedAnalytics(teamId)(dispatch, getState);
+}
+
+export function getPostsPerDayAnalytics(teamId) {
+    AdminActions.getPostsPerDayAnalytics(teamId)(dispatch, getState);
+}
+
+export function getUsersPerDayAnalytics(teamId) {
+    AdminActions.getUsersPerDayAnalytics(teamId)(dispatch, getState);
+}
-- 
cgit v1.2.3-1-g7c22

