refactor: adjust image upload
These fields are required but is not strictly validate at api level. API will return presigned url so that client can upload file to storage.
This commit is contained in:
parent
dedeecd6fa
commit
06fa3ab9ac
3 changed files with 24 additions and 22 deletions
|
|
@ -50,7 +50,7 @@ const useBranchContactStore = defineStore('api-branch-contact', () => {
|
|||
async function create(
|
||||
branchId: string,
|
||||
data: BranchContactCreate,
|
||||
qrCodeImage: File,
|
||||
qrCodeImage?: File | null, // required but not strict
|
||||
flow?: {
|
||||
sessionId: string;
|
||||
refTransactionId: string;
|
||||
|
|
@ -69,12 +69,13 @@ const useBranchContactStore = defineStore('api-branch-contact', () => {
|
|||
},
|
||||
});
|
||||
|
||||
await axios
|
||||
.put(res.data.qrCodeImageUploadUrl, qrCodeImage, {
|
||||
headers: { 'Content-Type': qrCodeImage.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e));
|
||||
qrCodeImage &&
|
||||
(await axios
|
||||
.put(res.data.qrCodeImageUploadUrl, qrCodeImage, {
|
||||
headers: { 'Content-Type': qrCodeImage.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e)));
|
||||
|
||||
if (!res) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -206,12 +206,13 @@ const useUserStore = defineStore('api-user', () => {
|
|||
},
|
||||
);
|
||||
|
||||
await axios
|
||||
.put(res.data.profileImageUploadUrl, profileImage, {
|
||||
headers: { 'Content-Type': profileImage.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e));
|
||||
profileImage &&
|
||||
(await axios
|
||||
.put(res.data.profileImageUploadUrl, profileImage, {
|
||||
headers: { 'Content-Type': profileImage.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e)));
|
||||
|
||||
if (!res) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ export type User = {
|
|||
profileImageUrl: string;
|
||||
code: string;
|
||||
birthDate?: Date | null;
|
||||
responsibleArea: string,
|
||||
branch: Branch[]
|
||||
responsibleArea: string;
|
||||
branch: Branch[];
|
||||
};
|
||||
|
||||
export type UserCreate = {
|
||||
|
|
@ -72,9 +72,9 @@ export type UserCreate = {
|
|||
userRole: string;
|
||||
userType: string;
|
||||
keycloakId: string;
|
||||
profileImage: File;
|
||||
profileImage?: File | null; // required but not strict
|
||||
birthDate?: Date | null;
|
||||
responsibleArea: string,
|
||||
responsibleArea: string;
|
||||
};
|
||||
|
||||
export type UserAttachment = {
|
||||
|
|
@ -95,14 +95,14 @@ export type UserTypeStats = {
|
|||
MESSENGER: number;
|
||||
DELEGATE: number;
|
||||
AGENCY: number;
|
||||
}
|
||||
};
|
||||
|
||||
export type UserOption = {
|
||||
hqOpts: Option[]
|
||||
brOpts: Option[]
|
||||
}
|
||||
hqOpts: Option[];
|
||||
brOpts: Option[];
|
||||
};
|
||||
|
||||
export type Option = {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue