Fix bad types in Account kcContext

This commit is contained in:
garronej 2023-04-20 13:10:33 +02:00
parent 61dc54f115
commit 984d12b3f2
2 changed files with 4 additions and 10 deletions

View File

@ -28,11 +28,6 @@ export declare namespace KcContext {
resourcesPath: string;
/** @deprecated, not present in recent keycloak version apparently, use kcContext.referrer instead */
referrerURI?: string;
// Present only if redirected to account page with ?referrer=xxx&referrer_uri=http...
referrer?: {
url: string; // The url of the App
name: string; // NOTE: Client id
};
getLogoutUrl: () => string;
};
features: {
@ -45,13 +40,14 @@ export declare namespace KcContext {
internationalizationEnabled: boolean;
userManagedAccessAllowed: boolean;
};
// Present only if redirected to account page with ?referrer=xxx&referrer_uri=http...
message?: {
type: "success" | "warning" | "error" | "info";
summary: string;
};
referrer?: {
url?: string;
name: string;
url: string; // The url of the App
name: string; // Client id
};
messagesPerField: {
printIfExists: <T>(fieldName: string, x: T) => T | undefined;

View File

@ -99,9 +99,7 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
<div className="form-group">
<div id="kc-form-buttons" className="col-md-offset-2 col-md-10 submit">
<div>
{(referrer !== undefined || url.referrerURI !== undefined) && (
<a href={referrer?.url ?? url.referrerURI}>{msg("backToApplication")}</a>
)}
{referrer !== undefined && <a href={referrer?.url}>{msg("backToApplication")}</a>}
<button
type="submit"
className={clsx(