mirror of
https://github.com/status-im/consul.git
synced 2025-01-23 03:59:18 +00:00
049ca102c4
* feat: add api call to hcp/link endpoint * updated * updated * update approach to get the linking status * updated application template * feat: add api call to hcp/link endpoint * updated * updated * update approach to get the linking status * updated application template * update purple banner links * Hook up the linked check to the purple banner * fixed lint issue * Updated tests for new link status API calls as args instead of from service --------- Co-authored-by: Chris Hut <tophernuts@gmail.com>
33 lines
752 B
JavaScript
33 lines
752 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Service from '@ember/service';
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
const LOCAL_STORAGE_KEY = 'consul:hideHcpLinkBanner';
|
|
|
|
export default class HcpLinkStatus extends Service {
|
|
@tracked
|
|
userDismissedBanner = false;
|
|
|
|
get shouldDisplayBanner() {
|
|
return !this.userDismissedBanner;
|
|
}
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
this.userDismissedBanner = !!localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
}
|
|
|
|
userHasLinked() {
|
|
// TODO: CC-7145 - once can fetch the link status from the backend, fetch it and set it here
|
|
}
|
|
|
|
dismissHcpLinkBanner() {
|
|
localStorage.setItem(LOCAL_STORAGE_KEY, true);
|
|
this.userDismissedBanner = true;
|
|
}
|
|
}
|