diff --git a/src/stores/branch-contact/index.ts b/src/stores/branch-contact/index.ts index 1fe82acc..dbdb7fc9 100644 --- a/src/stores/branch-contact/index.ts +++ b/src/stores/branch-contact/index.ts @@ -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; diff --git a/src/stores/user/index.ts b/src/stores/user/index.ts index 657359b8..4b45c31b 100644 --- a/src/stores/user/index.ts +++ b/src/stores/user/index.ts @@ -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; diff --git a/src/stores/user/types.ts b/src/stores/user/types.ts index 044d389a..c17d8d1a 100644 --- a/src/stores/user/types.ts +++ b/src/stores/user/types.ts @@ -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; -} +};