Skip to content

Commit d929d3f

Browse files
committed
[DOP-29841] Use Keycloak components only if authProvider==keycloak
1 parent 5e7505a commit d929d3f

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/app/config/errorBoundary/Fallback.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const Fallback = ({ error, resetErrorBoundary }: FallbackProps) => {
1212
if ('status' in error) {
1313
switch (error.status) {
1414
case ErrorStatusCode.AUTH:
15-
if (AUTH_PROVIDER === AuthProviderType.DUMMY) {
16-
return <AuthError />;
15+
if (AUTH_PROVIDER === AuthProviderType.KEYCLOAK) {
16+
return <KeycloakAuthError />;
1717
}
18-
return <KeycloakAuthError />;
18+
return <AuthError />;
1919
case ErrorStatusCode.ACCESS:
2020
return <AccessError />;
2121
case ErrorStatusCode.NOT_FOUND:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { AUTH_PROVIDER, AuthProviderType, Storage } from '@shared/constants';
22

33
export const isAuthenticated = () => {
4-
if (AUTH_PROVIDER === AuthProviderType.DUMMY) {
5-
return !!localStorage.getItem(Storage.ACCESS_TOKEN);
4+
if (AUTH_PROVIDER === AuthProviderType.KEYCLOAK) {
5+
return !!localStorage.getItem(Storage.IS_KEYCLOAK_AUTH);
66
}
77

8-
return !!localStorage.getItem(Storage.IS_KEYCLOAK_AUTH);
8+
return !!localStorage.getItem(Storage.ACCESS_TOKEN);
99
};

src/pages/auth/LoginPage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { AUTH_PROVIDER, AuthProviderType } from '@shared/constants';
33
import React from 'react';
44

55
export const LoginPage = () => {
6-
if (AUTH_PROVIDER === AuthProviderType.DUMMY) {
7-
return <Login />;
6+
if (AUTH_PROVIDER === AuthProviderType.KEYCLOAK) {
7+
return <KeycloakLogin />;
88
}
99

10-
return <KeycloakLogin />;
10+
return <Login />;
1111
};

src/widgets/layout/Header/components/LogoutButton/hooks/useLogoutButton/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export const useLogoutButton = () => {
1919
};
2020

2121
const handleClick = () => {
22-
if (AUTH_PROVIDER === AuthProviderType.DUMMY) {
23-
handleLogout();
24-
} else {
22+
if (AUTH_PROVIDER === AuthProviderType.KEYCLOAK) {
2523
handleKeycloakLogout();
24+
} else {
25+
handleLogout();
2626
}
2727
};
2828

0 commit comments

Comments
 (0)