X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2b22123ad358b8c6667e42779f6e52e9a14d9289..93b3e3b8e12c314717ed9b5f7339b158c067c718:/src/services/link-account-service/link-account-service.ts diff --git a/src/services/link-account-service/link-account-service.ts b/src/services/link-account-service/link-account-service.ts index cc7c62ebdb..b7298a8533 100644 --- a/src/services/link-account-service/link-account-service.ts +++ b/src/services/link-account-service/link-account-service.ts @@ -4,11 +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"; -import { AuthService } from "../auth-service/auth-service"; export const USER_LINK_ACCOUNT_KEY = 'accountToLink'; +export const ACCOUNT_LINK_STATUS_KEY = 'accountLinkStatus'; export class LinkAccountService { @@ -16,19 +16,32 @@ export class LinkAccountService { protected serverApi: AxiosInstance, protected actions: ApiActions) { } - public saveToSession(account: AccountToLink) { + public saveAccountToLink(account: AccountToLink) { sessionStorage.setItem(USER_LINK_ACCOUNT_KEY, JSON.stringify(account)); } - public removeFromSession() { + public removeAccountToLink() { sessionStorage.removeItem(USER_LINK_ACCOUNT_KEY); } - public getFromSession() { + public getAccountToLink() { const data = sessionStorage.getItem(USER_LINK_ACCOUNT_KEY); 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, @@ -36,9 +49,9 @@ export class LinkAccountService { redirect_to_new_user: true }; return CommonService.defaultResponse( - this.serverApi.post('/users/merge/', params), + this.serverApi.post('/users/merge', params), this.actions, false ); } -} \ No newline at end of file +}