Do not log out current user (#4291)

This commit is contained in:
Erik Jan de Wit 2023-02-06 11:45:18 +01:00 committed by GitHub
parent 0659324b60
commit e57c8f3eb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -76,11 +76,4 @@ describe("Sessions test", () => {
);
});
});
describe("logout all sessions", () => {
it("logout all sessions", () => {
sessionsPage.logoutAllSessions();
cy.get("#kc-page-title").contains("Sign in to your account");
});
});
});

View file

@ -16,7 +16,9 @@ import "./SessionsSection.css";
export default function SessionsSection() {
const { t } = useTranslation("sessions");
const { keycloak, adminClient } = useAdminClient();
const { adminClient } = useAdminClient();
const [key, setKey] = useState(0);
const refresh = () => setKey(key + 1);
const { addError } = useAlerts();
const { realm } = useRealm();
@ -58,7 +60,7 @@ export default function SessionsSection() {
onConfirm: async () => {
try {
await adminClient.realms.logoutAll({ realm });
keycloak.logout({ redirectUri: "" });
refresh();
} catch (error) {
addError("sessions:logoutAllSessionsError", error);
}
@ -103,7 +105,7 @@ export default function SessionsSection() {
}}
/>
)}
<SessionsTable loader={loader} />
<SessionsTable key={key} loader={loader} />
</PageSection>
</>
);