mirror of
https://github.com/portainer/portainer.git
synced 2025-08-08 07:15:23 +02:00
feat(app): clear env when log out [EE-4791] (#8218)
This commit is contained in:
parent
123754cee7
commit
701410d259
3 changed files with 15 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
|||
import { ping } from '@/docker/services/ping';
|
||||
import { environmentStore } from '@/react/hooks/current-environment-store';
|
||||
import {
|
||||
Environment,
|
||||
EnvironmentType,
|
||||
|
@ -9,6 +10,8 @@ interface State {
|
|||
pingInterval: NodeJS.Timer | null;
|
||||
}
|
||||
|
||||
const DEFAULT_TITLE = 'Portainer';
|
||||
|
||||
/* @ngInject */
|
||||
export function EndpointProvider() {
|
||||
const state: State = {
|
||||
|
@ -16,6 +19,12 @@ export function EndpointProvider() {
|
|||
pingInterval: null,
|
||||
};
|
||||
|
||||
environmentStore.subscribe((state) => {
|
||||
if (!state.environmentId) {
|
||||
setCurrentEndpoint(null);
|
||||
}
|
||||
});
|
||||
|
||||
return { endpointID, setCurrentEndpoint, currentEndpoint, clean };
|
||||
|
||||
function endpointID() {
|
||||
|
@ -40,6 +49,10 @@ export function EndpointProvider() {
|
|||
JSON.stringify(undefined)
|
||||
);
|
||||
}
|
||||
|
||||
document.title = endpoint
|
||||
? `${DEFAULT_TITLE} | ${endpoint.Name}`
|
||||
: `${DEFAULT_TITLE}`;
|
||||
}
|
||||
|
||||
function currentEndpoint() {
|
||||
|
@ -48,6 +61,7 @@ export function EndpointProvider() {
|
|||
|
||||
function clean() {
|
||||
setCurrentEndpoint(null);
|
||||
environmentStore.getState().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue