-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix/contacts - Исправление раздела "Контакты" #206
Merged
Merged
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3f5ad9e
feat: подключить бэкенд для загрузки контактов, добавить редактирован…
IvannaBalanyuk 788a7f4
fix: исправить верстку, реализовать адаптивность
IvannaBalanyuk 8e11927
Merge branch 'develop' of github.com:ya-pomogau/frontend into fix/con…
IvannaBalanyuk ecd7ab9
fix: исправить импорт для TContacts
IvannaBalanyuk 6a845a2
fix: вернуть usePermission к исходному состоянию
IvannaBalanyuk 2474682
hotfix: вынести повторяющийся блок верстки в функцию getContactContainer
IvannaBalanyuk 4505018
hotfix: убрать слайс для contacts и его применение
IvannaBalanyuk c709164
hotfix: для инпутов применить useForm вместо useState
IvannaBalanyuk 2d0fa42
hotfix: убрать условную конструкцию if из onSubmit
IvannaBalanyuk e066e90
Merge branch 'develop' of github.com:ya-pomogau/frontend into fix/con…
IvannaBalanyuk 888d280
fix: вернуть usePermission к исходному состоянию
IvannaBalanyuk d700dba
hotfix: поправить паддинги у container (поправка на разницу в высоте …
IvannaBalanyuk aab1c45
fix: перенести useUpdateContactsMutation в adminApi
IvannaBalanyuk c083ab0
fix: внести правки в части обновления контактов (добавить id в запрос)
IvannaBalanyuk 27f716e
hotfix: добавить валидацию из useform, убрать передачу id в params пр…
IvannaBalanyuk d7f8d83
fix: вернуть usePermission к исходному состоянию
IvannaBalanyuk d6dcb68
hotfix: вернуть setValues из useForm, применить в useEffect в Contact…
IvannaBalanyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; | ||
import { TContacts } from '../types'; | ||
|
||
const initialState: TContacts = { | ||
email: null, | ||
socialNetwork: null, | ||
}; | ||
|
||
export const contactsModel = createSlice({ | ||
name: 'contacts', | ||
initialState, | ||
reducers: { | ||
setContacts: (state, { payload }: PayloadAction<TContacts | null>) => { | ||
state.email = payload?.email; | ||
state.socialNetwork = payload?.socialNetwork; | ||
}, | ||
}, | ||
}); | ||
|
||
export const { setContacts } = contactsModel.actions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './contacts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type TContacts = { | ||
email: string | null | undefined; | ||
socialNetwork: string | null | undefined; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
По-хорошему, тут должен быть хук useForm
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.
useForm
Не смогла решить такую проблему - при обновлении страницы инпуты опустошаются и значения снова отображаются только после ререндера (например, после нажатия на кнопку редактирования или перехода между вкладками)
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.
Да, корректно в этом плане работало только когда обращение за данными на бэк и setContsctsData были обернуты в UseEffect (по отдельности). Тогда при обновлении происходил запрос к бэку и после этого отрабатывал второй useEffect (с setContsctsData), так как у него в зависимостях были данные, получаемые с бэка.
Может из хука useForm ёще setValues возвращать?
Вот так всё работает корректно:
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.
@INextYP слушай, а может просто завести слайс
system
в хранилище, и туда прям на монтированииApp
затягивать конфиденциальность, контакты и всё прочее такое?А потом по WS сделаем апдейты при изменении.