Skip signin page if auth config is empty (#33)

* Fixing behaviour for secure and non-secure mode

* Adding swagger html to prettier ignore files
This commit is contained in:
darth-coder00 2021-08-03 18:32:27 +05:30 committed by GitHub
parent f92151eed1
commit dba033711d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -30,5 +30,10 @@ dist/
.prettierignore .prettierignore
.eslintignore .eslintignore
# rc, json and html files
.prettierrc
.lintstagedrc.json
swagger.html
# macOS # macOS
.DS_Store .DS_Store

View File

@ -17,7 +17,7 @@
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { CookieStorage } from 'cookie-storage'; import { CookieStorage } from 'cookie-storage';
import { isEmpty } from 'lodash'; import { isEmpty, isNil } from 'lodash';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { User } from 'Models'; import { User } from 'Models';
import { UserManager, WebStorageStateStore } from 'oidc-client'; import { UserManager, WebStorageStateStore } from 'oidc-client';
@ -155,7 +155,10 @@ const AuthProvider: FunctionComponent<AuthProviderProps> = ({
const fetchAuthConfig = (): void => { const fetchAuthConfig = (): void => {
fetchAuthorizerConfig() fetchAuthorizerConfig()
.then((res: AxiosResponse) => { .then((res: AxiosResponse) => {
if (res.data) { const isSecureMode =
!isNil(res.data) &&
Object.values(res.data).filter((item) => isNil(item)).length === 0;
if (isSecureMode) {
const { provider, authority, clientId, callbackUrl } = res.data; const { provider, authority, clientId, callbackUrl } = res.data;
const userConfig = getUserManagerConfig({ const userConfig = getUserManagerConfig({
authority, authority,

View File

@ -100,7 +100,7 @@ const Signup = () => {
...details, ...details,
teams: selectedTeams as Array<string>, teams: selectedTeams as Array<string>,
profile: { profile: {
images: getImages(appState.newUser.picture), images: getImages(appState.newUser.picture ?? ''),
}, },
}); });
} }