|
|
@@ -11,17 +11,13 @@ import type { IExternalAccountLoginError } from '~/interfaces/errors/external-ac
|
|
|
import { LoginErrorCode } from '~/interfaces/errors/login-error';
|
|
|
import type { IErrorV3 } from '~/interfaces/errors/v3-error';
|
|
|
import { RegistrationMode } from '~/interfaces/registration-mode';
|
|
|
-import { useIsAdmin } from '~/stores/context';
|
|
|
import { toArrayIfNot } from '~/utils/array-utils';
|
|
|
-import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
import { CompleteUserRegistration } from './CompleteUserRegistration';
|
|
|
|
|
|
|
|
|
import styles from './LoginForm.module.scss';
|
|
|
|
|
|
-const logger = loggerFactory('components:Page:RevisionRenderer');
|
|
|
-
|
|
|
type LoginFormProps = {
|
|
|
username?: string,
|
|
|
name?: string,
|
|
|
@@ -38,7 +34,6 @@ type LoginFormProps = {
|
|
|
externalAccountLoginError?: IExternalAccountLoginError,
|
|
|
}
|
|
|
export const LoginForm = (props: LoginFormProps): JSX.Element => {
|
|
|
- // const { data: isAdmin } = useIsAdmin();
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
const router = useRouter();
|
|
|
@@ -109,7 +104,6 @@ export const LoginForm = (props: LoginFormProps): JSX.Element => {
|
|
|
const res = await apiv3Post('/login', { loginForm });
|
|
|
const { redirectTo, isAdmin } = res.data;
|
|
|
|
|
|
- // redirectTo === '/admin' かつ、リクエストを投げたユーザーがadminでなければ、、っていう条件式
|
|
|
if (!isAdmin && redirectTo === '/admin') {
|
|
|
return router.push('/');
|
|
|
}
|