15088: Adds reload after link account operation
[arvados-workbench2.git] / src / services / link-account-service / link-account-service.ts
index 74fc5eb6a5338025967f71cba5cfe100a7e768c9..ebae69ac37da2216d3f91aa1a2abc9017837ce77 100644 (file)
@@ -4,10 +4,11 @@
 
 import { AxiosInstance } from "axios";
 import { ApiActions } from "~/services/api/api-actions";
-import { AccountToLink } from "~/models/link-account";
+import { AccountToLink, LinkAccountStatus } from "~/models/link-account";
 import { CommonService } from "~/services/common-service/common-service";
 
 export const USER_LINK_ACCOUNT_KEY = 'accountToLink';
+export const ACCOUNT_LINK_STATUS_KEY = 'accountLinkStatus';
 
 export class LinkAccountService {
 
@@ -28,6 +29,19 @@ export class LinkAccountService {
         return data ? JSON.parse(data) as AccountToLink : undefined;
     }
 
+    public saveLinkOpStatus(status: LinkAccountStatus) {
+        sessionStorage.setItem(ACCOUNT_LINK_STATUS_KEY, JSON.stringify(status));
+    }
+
+    public removeLinkOpStatus() {
+        sessionStorage.removeItem(ACCOUNT_LINK_STATUS_KEY);
+    }
+
+    public getLinkOpStatus() {
+        const data = sessionStorage.getItem(ACCOUNT_LINK_STATUS_KEY);
+        return data ? JSON.parse(data) as LinkAccountStatus : undefined;
+    }
+
     public linkAccounts(newUserToken: string, newGroupUuid: string) {
         const params = {
             new_user_token: newUserToken,