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; resourcesPath: string;
/** @deprecated, not present in recent keycloak version apparently, use kcContext.referrer instead */ /** @deprecated, not present in recent keycloak version apparently, use kcContext.referrer instead */
referrerURI?: string; 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; getLogoutUrl: () => string;
}; };
features: { features: {
@ -45,13 +40,14 @@ export declare namespace KcContext {
internationalizationEnabled: boolean; internationalizationEnabled: boolean;
userManagedAccessAllowed: boolean; userManagedAccessAllowed: boolean;
}; };
// Present only if redirected to account page with ?referrer=xxx&referrer_uri=http...
message?: { message?: {
type: "success" | "warning" | "error" | "info"; type: "success" | "warning" | "error" | "info";
summary: string; summary: string;
}; };
referrer?: { referrer?: {
url?: string; url: string; // The url of the App
name: string; name: string; // Client id
}; };
messagesPerField: { messagesPerField: {
printIfExists: <T>(fieldName: string, x: T) => T | undefined; 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 className="form-group">
<div id="kc-form-buttons" className="col-md-offset-2 col-md-10 submit"> <div id="kc-form-buttons" className="col-md-offset-2 col-md-10 submit">
<div> <div>
{(referrer !== undefined || url.referrerURI !== undefined) && ( {referrer !== undefined && <a href={referrer?.url}>{msg("backToApplication")}</a>}
<a href={referrer?.url ?? url.referrerURI}>{msg("backToApplication")}</a>
)}
<button <button
type="submit" type="submit"
className={clsx( className={clsx(