feat: submit new password to backend and submit user information and add Form to UserSettingProfile (#114)

* feat: add Form to UserSettingProfile

* feat: submit user information

* feat: submit new password to backend
This commit is contained in:
balibabu
2024-03-08 17:09:07 +08:00
committed by GitHub
parent 8f86ab9f7f
commit fa171dfe6c
15 changed files with 880 additions and 32 deletions

View File

@@ -1,3 +1,5 @@
import { UploadFile } from 'antd';
export const transformFile2Base64 = (val: any): Promise<any> => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
@@ -26,3 +28,28 @@ export const transformBase64ToFile = (
}
return new File([u8arr], filename, { type: mimeType });
};
export const normFile = (e: any) => {
if (Array.isArray(e)) {
return e;
}
return e?.fileList;
};
export const getUploadFileListFromBase64 = (avatar: string) => {
let fileList: UploadFile[] = [];
if (avatar) {
fileList = [{ uid: '1', name: 'file', thumbUrl: avatar, status: 'done' }];
}
return fileList;
};
export const getBase64FromUploadFileList = (fileList?: UploadFile[]) => {
if (Array.isArray(fileList) && fileList.length > 0) {
return fileList[0].thumbUrl;
}
return '';
};