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:
@@ -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 '';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user