Refactor to apply global navigation actions
[arvados-workbench2.git] / src / store / auth / auth-action.ts
index 33a5df90450e2cde772c73c8d80c7b06854c4f12..72e2d3453299322775da2d421a5417e34d0eb5e0 100644 (file)
@@ -8,6 +8,8 @@ import { User } from "~/models/user";
 import { RootState } from "../store";
 import { ServiceRepository } from "~/services/services";
 import { AxiosInstance } from "axios";
+import { initSidePanelTree } from '../side-panel-tree/side-panel-tree-actions';
+import { updateResources } from '../resources/resources-actions';
 
 export const authActions = unionize({
     SAVE_API_TOKEN: ofType<string>(),
@@ -34,16 +36,17 @@ function removeAuthorizationHeader(client: AxiosInstance) {
     delete client.defaults.headers.common.Authorization;
 }
 
-export const initAuth = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-    const user = services.authService.getUser();
-    const token = services.authService.getApiToken();
-    if (token) {
-        setAuthorizationHeader(services, token);
-    }
-    if (token && user) {
-        dispatch(authActions.INIT({ user, token }));
-    }
-};
+export const initAuth = () =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const user = services.authService.getUser();
+        const token = services.authService.getApiToken();
+        if (token) {
+            setAuthorizationHeader(services, token);
+        }
+        if (token && user) {
+            dispatch(authActions.INIT({ user, token }));
+        }
+    };
 
 export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     services.authService.saveApiToken(token);