-
Notifications
You must be signed in to change notification settings - Fork 1
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
DEAD-27: implement normal history api and url transitions #7
base: DEAD-4-NEW
Are you sure you want to change the base?
Conversation
dist/main.js
Outdated
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.
добавь в гитигнор
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.
обычно названия файлов в camelCase пишут
answer = response.body.data; | ||
break; | ||
default: | ||
console.error('Error', response.status, response.error); |
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.
400+ методы должны нормально обрабатывать в приложении. Помню обсуждали на созвоне, ошибки тоже надо вытаскивать из респонса бекенда. И response.error - это ошибка сети а не апи.
Давай возвращать проверять боди и возвращать данные даже в случае ошибочных статусов. Посмотри что бекенд отдает сейчас на эту ручку вместе с 400/500
export const ApiPaths = { | ||
baseUrl: 'http://localhost:8000/api/v1', | ||
user: { | ||
login: '/login', | ||
register: '/register', | ||
logout: '/logout', | ||
}, | ||
feed: '/feed', | ||
}; |
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.
переведи в UPPER_SNAKE_CASE, константы в нем принято писать
} | ||
|
||
isValidEmail(email) { | ||
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; |
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.
почему var?
} | ||
|
||
isValidPassword(password) { | ||
const passwordRegex = /^[a-zA-Z0-9?!_\-*$]{6,}$/; |
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.
нет ограничения на макс. кол-во символов + надо еще разрешать (
)
-
+
,
.
=
. Вообще уменьшение кол-во возможных символов для ввода это плохая практика: https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html#implement-proper-password-strength-controls
|
||
render() { | ||
const placeForHeader = document.querySelector('.place-for-header'); | ||
placeForHeader.innerHTML = ''; |
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.
зачем сначала задавать ''
, а потом присваивать innerHTML = template
? можно сразу присвоить template
AuthHref.addEventListener('click', (event) => { | ||
event.preventDefault(); | ||
Navigator.navigateTo('/auth'); | ||
}); |
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.
Тут может течь память так как листенеры надо чистить руками. Продумай логику так, чтобы колбеки сохранялись и вызывался removeEventListener при удалении компонента. Это всего кода касается
const EmailInputVal = document.querySelector('#email-input').value.trim(); | ||
const PasswordInputVal = document.querySelector('#password-input').value.trim(); |
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.
trim лучше убери
src/images/1.jpg:Zone.Identifier
Outdated
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.
что-то лишнее
No description provided.