fix(#188): tunisia pr fix

pull/108/head
Rakov Roman 3 years ago
parent eafdc35971
commit ba23f5258d
  1. 6
      src/features/AuthServiceApp/hooks/useAuthFields.tsx
  2. 8
      src/features/ProfileHeader/index.tsx

@ -7,6 +7,8 @@ import { useState } from 'react'
import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail' import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail'
import { isValidPassword } from 'features/AuthServiceApp/helpers/isValidPassword' import { isValidPassword } from 'features/AuthServiceApp/helpers/isValidPassword'
import { PAGES } from 'features/AuthServiceApp/config/pages'
export const useAuthFields = (page: 'login'|'registration') => { export const useAuthFields = (page: 'login'|'registration') => {
const [email, setEmail] = useState('') const [email, setEmail] = useState('')
const [password, setPassword] = useState('') const [password, setPassword] = useState('')
@ -20,7 +22,7 @@ export const useAuthFields = (page: 'login'|'registration') => {
const onEmailChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => { const onEmailChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => {
setError('') setError('')
setEmail(value) setEmail(value)
const isRegisterPage = page === 'registration' const isRegisterPage = page === PAGES.registration
if (password.length && !checkPassword(password) && isRegisterPage) { if (password.length && !checkPassword(password) && isRegisterPage) {
setError('check_password') setError('check_password')
} }
@ -29,7 +31,7 @@ export const useAuthFields = (page: 'login'|'registration') => {
const onPasswordChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => { const onPasswordChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => {
setError('') setError('')
setPassword(value) setPassword(value)
const isRegisterPage = page === 'registration' const isRegisterPage = page === PAGES.registration
if (!checkPassword(value) && isRegisterPage) { if (!checkPassword(value) && isRegisterPage) {
setError('check_password') setError('check_password')
} }

@ -33,6 +33,11 @@ type Props = {
profileId?: number, profileId?: number,
} }
const profileWithImage = {
316: 'Spain',
5704: 'Tunis',
}
export const ProfileHeader = ({ export const ProfileHeader = ({
children, children,
color: headerColor, color: headerColor,
@ -46,7 +51,8 @@ export const ProfileHeader = ({
} = usePageParams() } = usePageParams()
const color = useProfileColor(profileId) const color = useProfileColor(profileId)
const imageHeader = (profileId === 5704 || profileId === 316) // @ts-ignore
const imageHeader = Boolean(profileWithImage[profileId])
&& sportType === SportTypes.FOOTBALL && sportType === SportTypes.FOOTBALL
&& profileType === ProfileTypes.TOURNAMENTS ? `/images/${profileId}` : headerImage && profileType === ProfileTypes.TOURNAMENTS ? `/images/${profileId}` : headerImage

Loading…
Cancel
Save