-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/user profile #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| import type { TextFieldConfig } from './types'; | ||
|
|
||
| export const TEXT_FIELDS: TextFieldConfig[] = [ | ||
| { key: 'firstName', label: 'First Name' }, | ||
| { key: 'lastName', label: 'Last Name' }, | ||
| { key: 'email', label: 'Email' }, | ||
| { key: 'password', label: 'Password', type: 'password' }, | ||
| ]; | ||
|
|
||
| export const ERROR_MESSAGES = { | ||
| REQUIRED: 'This field is required', | ||
| FIRST_NAME_REQUIRED: 'First name is required', | ||
| LAST_NAME_REQUIRED: 'Last name is required', | ||
| EMAIL_REQUIRED: 'Email is required', | ||
| PASSWORD_REQUIRED: 'Password is required', | ||
| BIRTH_DATE_REQUIRED: 'Date of birth is required', | ||
| SHIPPING_ADDRESS_REQUIRED: 'Please select a default shipping address', | ||
| BILLING_ADDRESS_REQUIRED: 'Please select a default billing address', | ||
|
|
||
| LETTERS_ONLY: 'Only letters allowed', | ||
| INVALID_EMAIL: 'Enter correct email', | ||
| INVALID_PASSWORD: | ||
| 'Minimum 8 characters, at least 1 uppercase letter, 1 lowercase letter, and 1 number', | ||
| AGE_RESTRICTION: 'You must be older than 13 years old', | ||
| INVALID_SHIPPING_ADDRESS: 'Invalid default shipping address', | ||
| INVALID_BILLING_ADDRESS: 'Invalid default billing address', | ||
| }; | ||
|
|
||
| export const MIN_AGE = 13; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это круто, что ты выносишь в переменные тексты 👍
| const loginWithCommercetools = async (credentials: ILoginFormProps) => { | ||
| try { | ||
| await switchToPasswordFlow(credentials.email, credentials.password); | ||
| //NEED REFACTOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
есть плагины для VSCode Todo Tree или Better Comments. Для подобных комментариев 🔥
| }) => { | ||
| //PUT TO SHARED | ||
| const formatDate = (dateString: string) => { | ||
| return new Date(dateString).toLocaleDateString('en-US', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
язык лучше было вынести в константу
| window.addEventListener('authStatusChanged', () => { | ||
| const isAuth = localStorageService.getAuthStatus(); | ||
| if (!isAuth) navigate('/'); | ||
| if (!isAuth) navigate('/login'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
отлично
Left some comments for refactoring and improving code, please leave it after merge