Skip to content

Commit 9c0fe75

Browse files
committed
refactor: use better names for context in login page
1 parent bc7c604 commit 9c0fe75

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎frontend/src/pages/login-page.tsx‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ const iconMap: Record<string, React.ReactNode> = {
3737

3838
export const LoginPage = () => {
3939
const { auth, tailscale } = useUserContext();
40-
const { ui, oauth, auth: cauth } = useAppContext();
40+
const {
41+
ui,
42+
oauth,
43+
auth: { providers },
44+
} = useAppContext();
4145
const { search } = useLocation();
4246
const { t } = useTranslation();
4347

@@ -56,15 +60,15 @@ export const LoginPage = () => {
5660
const oidcParams = useOIDCParams(searchParams);
5761

5862
const [isOauthAutoRedirect, setIsOauthAutoRedirect] = useState(
59-
cauth.providers.find((provider) => provider.id === oauth.autoRedirect) !==
63+
providers.find((provider) => provider.id === oauth.autoRedirect) !==
6064
undefined && redirectUri !== undefined,
6165
);
6266

63-
const oauthProviders = cauth.providers.filter(
67+
const oauthProviders = providers.filter(
6468
(provider) => provider.id !== "local" && provider.id !== "ldap",
6569
);
6670
const userAuthConfigured =
67-
cauth.providers.find(
71+
providers.find(
6872
(provider) => provider.id === "local" || provider.id === "ldap",
6973
) !== undefined;
7074

@@ -300,7 +304,7 @@ export const LoginPage = () => {
300304
<Card>
301305
<CardHeader className="gap-1.5">
302306
<CardTitle className="text-center text-xl">{ui.title}</CardTitle>
303-
{cauth.providers.length > 0 && (
307+
{providers.length > 0 && (
304308
<CardDescription className="text-center">
305309
{oauthProviders.length !== 0
306310
? t("loginTitle")
@@ -338,7 +342,7 @@ export const LoginPage = () => {
338342
})()}
339343
/>
340344
)}
341-
{cauth.providers.length == 0 && (
345+
{providers.length == 0 && (
342346
<pre className="break-normal! text-sm text-red-600">
343347
{t("failedToFetchProvidersTitle")}
344348
</pre>

0 commit comments

Comments
 (0)