Skip to content

Commit 8e78c51

Browse files
committed
feat: auth page
1 parent 92b7db6 commit 8e78c51

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

frontend/src/components/AuthPage/AuthPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ function AuthPage() {
1111
return (
1212
<S.AuthPageStyled>
1313
<Header />
14-
{data && <SignIn appAuthenticationSettings={data} />}
14+
{data && (
15+
<SignIn authType={data.authType} oAuthProviders={data.oAuthProviders} />
16+
)}
1517
</S.AuthPageStyled>
1618
);
1719
}

frontend/src/components/AuthPage/SignIn/BasicSignIn/BasicSignIn.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function BasicSignIn() {
2727
methods.setError('root', { message: 'error' });
2828
} else {
2929
navigate('/');
30+
window.location.reload();
3031
}
3132
},
3233
});

frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function AuthCard({ serviceName, authPath, Icon = ServiceImage }: Props) {
2424
<S.ServiceButton
2525
buttonSize="L"
2626
buttonType="primary"
27-
to={`http://localhost:8080${authPath}`}
27+
to={`${window.basePath}${authPath}`}
2828
>
2929
Log in with {serviceName}
3030
</S.ServiceButton>

frontend/src/components/AuthPage/SignIn/SignIn.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import React from 'react';
2-
import { AppAuthenticationSettings, AuthType } from 'generated-sources';
2+
import { AuthType, OAuthProvider } from 'generated-sources';
33

44
import BasicSignIn from './BasicSignIn/BasicSignIn';
55
import * as S from './SignIn.styled';
66
import OAuthSignIn from './OAuthSignIn/OAuthSignIn';
77

88
interface Props {
9-
appAuthenticationSettings: AppAuthenticationSettings;
9+
authType?: AuthType;
10+
oAuthProviders?: OAuthProvider[];
1011
}
1112

12-
function SignInForm({ appAuthenticationSettings }: Props) {
13-
const { authType, oAuthProviders } = appAuthenticationSettings;
14-
13+
function SignInForm({ authType, oAuthProviders }: Props) {
1514
return (
1615
<S.SignInStyled>
1716
<S.SignInTitle>Sign in</S.SignInTitle>

frontend/src/components/contexts/GlobalSettingsContext.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@ export const GlobalSettingsProvider: React.FC<
1717
> = ({ children }) => {
1818
const info = useAppInfo();
1919
const navigate = useNavigate();
20+
const [value, setValue] = React.useState<GlobalSettingsContextProps>({
21+
hasDynamicConfig: false,
22+
});
2023

2124
React.useEffect(() => {
2225
if (info.data?.raw.url.includes('auth')) {
2326
navigate('auth');
27+
return;
2428
}
25-
}, []);
2629

27-
const value = React.useMemo(() => {
28-
const features = info.data?.enabledFeatures || [];
29-
return {
30-
hasDynamicConfig: features.includes(
31-
ApplicationInfoEnabledFeaturesEnum.DYNAMIC_CONFIG
32-
),
33-
};
30+
info.data?.value().then((res) => {
31+
const features = res?.enabledFeatures || [];
32+
setValue({
33+
hasDynamicConfig: features.includes(
34+
ApplicationInfoEnabledFeaturesEnum.DYNAMIC_CONFIG
35+
),
36+
});
37+
});
3438
}, [info.data]);
3539

3640
return (

0 commit comments

Comments
 (0)