fix: fix main filter point, fix save profile pictures
This commit is contained in:
parent
3345a533d2
commit
3ed78c0e45
|
@ -34,8 +34,7 @@ const nextConfig = {
|
|||
},
|
||||
// output: 'standalone',
|
||||
poweredByHeader: false,
|
||||
productionBrowserSourceMaps: true,
|
||||
trailingSlash: true
|
||||
productionBrowserSourceMaps: true
|
||||
};
|
||||
|
||||
module.exports = withNextIntl(nextConfig);
|
||||
|
|
|
@ -15,6 +15,7 @@ import { OutlinedButton } from '../view/OutlinedButton';
|
|||
import {FilledButton, FilledSquareButton, FilledYellowButton} from '../view/FilledButton';
|
||||
import { DeleteAccountModal } from '../Modals/DeleteAccountModal';
|
||||
import { Loader } from '../view/Loader';
|
||||
import {ButtonProps} from "antd/es/button/button";
|
||||
|
||||
type ProfileSettingsProps = {
|
||||
locale: string;
|
||||
|
@ -40,6 +41,20 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
|||
}
|
||||
}, [profileSettings]);
|
||||
|
||||
const onSave = (newProfile: ProfileRequest) => {
|
||||
setSaveLoading(true);
|
||||
save(newProfile)
|
||||
.then(() => {
|
||||
fetchProfileSettings();
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось сохранить изменения');
|
||||
})
|
||||
.finally(() => {
|
||||
setSaveLoading(false);
|
||||
})
|
||||
}
|
||||
|
||||
const onSaveProfile = () => {
|
||||
form.validateFields()
|
||||
.then(({ login, surname, username }) => {
|
||||
|
@ -56,27 +71,18 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
|||
};
|
||||
|
||||
if (photo) {
|
||||
console.log(photo);
|
||||
const formData = new FormData();
|
||||
formData.append('file', photo as FileType);
|
||||
|
||||
newProfile.faceImage = `[${(photo as File).arrayBuffer()}]`;
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(photo as File);
|
||||
reader.onloadend = () => {
|
||||
const newReg = new RegExp('data:image/(png|jpg|jpeg);base64,')
|
||||
newProfile.faceImage = reader.result.replace(newReg, '');
|
||||
newProfile.isFaceImageKeepExisting = false;
|
||||
|
||||
onSave(newProfile);
|
||||
}
|
||||
} else {
|
||||
onSave(newProfile);
|
||||
}
|
||||
|
||||
console.log(newProfile);
|
||||
|
||||
setSaveLoading(true);
|
||||
save(newProfile)
|
||||
.then(() => {
|
||||
fetchProfileSettings();
|
||||
})
|
||||
.catch(() => {
|
||||
message.error('Не удалось сохранить изменения');
|
||||
})
|
||||
.finally(() => {
|
||||
setSaveLoading(false);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -103,6 +109,10 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
|||
modalTitle="Редактировать"
|
||||
modalOk="Сохранить"
|
||||
modalCancel="Отмена"
|
||||
modalProps={{
|
||||
okButtonProps: { className: 'b-button__filled_yellow' },
|
||||
cancelButtonProps: { className: 'b-button__outlined' }
|
||||
}}
|
||||
beforeCrop={beforeCrop}
|
||||
>
|
||||
<Upload
|
||||
|
@ -114,7 +124,7 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({ locale }) => {
|
|||
url: profileSettings.faceImageUrl
|
||||
}
|
||||
] : undefined}
|
||||
accept=".jpg,.jpeg,.png,.gif"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
beforeUpload={beforeUpload}
|
||||
multiple={false}
|
||||
showUploadList={false}
|
||||
|
|
|
@ -114,6 +114,7 @@ export const ExpertsFilter = ({
|
|||
...getObjectByAdditionalFilter(searchParams)
|
||||
};
|
||||
const search = getSearchParamsString(newFilter);
|
||||
console.log('basePath', basePath);
|
||||
|
||||
router.push(search ? `${basePath}?${search}#filter` : `${basePath}#filter`);
|
||||
|
||||
|
|
|
@ -109,10 +109,11 @@ textarea {
|
|||
}
|
||||
|
||||
.user-avatar {
|
||||
display: flex;
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
margin-bottom: 4px;
|
||||
grid-template-columns: 100px auto;
|
||||
|
||||
&__edit {
|
||||
position: relative;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { UploadFile } from 'antd';
|
||||
import { EducationDTO } from './education';
|
||||
import { ExpertsTags } from './tags';
|
||||
import { PracticeDTO } from './practice';
|
||||
|
@ -28,7 +27,7 @@ export type ProfileRequest = {
|
|||
languagesLinks?: { languageId: number }[];
|
||||
username?: string;
|
||||
surname?: string;
|
||||
faceImage?: UploadFile;
|
||||
faceImage?: any;
|
||||
isFaceImageKeepExisting?: boolean;
|
||||
phone?: string;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue