15088: Updates state to account for both types of linking and adds UI
[arvados-workbench2.git] / src / store / link-account-panel / link-account-panel-reducer.ts
index 4515cff44d2b66f7850dbb7374f1842e153a86bf..cbfb315b200c193342fe0a01bd0de9879b896c67 100644 (file)
@@ -3,18 +3,21 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { linkAccountPanelActions, LinkAccountPanelAction } from "~/store/link-account-panel/link-account-panel-actions";
-import { AccountToLink } from "~/models/link-account";
+import { UserResource, User } from "~/models/user";
 
 export interface LinkAccountPanelState {
-    accountToLink: AccountToLink | undefined;
+    user: UserResource | undefined;
+    userToLink: UserResource | undefined;
 }
 
 const initialState = {
-    accountToLink: undefined
+    user: undefined,
+    userToLink: undefined
 };
 
 export const linkAccountPanelReducer = (state: LinkAccountPanelState = initialState, action: LinkAccountPanelAction) =>
     linkAccountPanelActions.match(action, {
         default: () => state,
-        LOAD_LINKING: (accountToLink) => ({ ...state, accountToLink }),
+        LOAD_LINKING: ({ userToLink, user }) => ({ ...state, user, userToLink }),
+        REMOVE_LINKING: () => ({ ...state, user: undefined, userToLink: undefined })
     });
\ No newline at end of file