diff --git a/.gitignore b/.gitignore index 723ef36..204755a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.idea \ No newline at end of file +.idea +.DS_Store +.vscode \ No newline at end of file diff --git a/frontend/components/cart/delivery/AddressModal.vue b/frontend/components/cart/delivery/AddressModal.vue index 3e086da..d82b942 100644 --- a/frontend/components/cart/delivery/AddressModal.vue +++ b/frontend/components/cart/delivery/AddressModal.vue @@ -40,7 +40,7 @@ const addressData = ref({ address: address.value?.address ?? "", name: address.value?.name ?? "", phone: address.value?.phone ?? "", - for_me: !isEditing.value ? address.value?.for_me ?? "بله" : address.value?.for_me == true ? "بله" : "خیر", + for_me: !isEditing.value ? (address.value?.for_me ?? "بله") : address.value?.for_me == true ? "بله" : "خیر", is_main: address.value?.is_main ?? false, }); @@ -128,7 +128,7 @@ const handleSubmit = async () => { }, }); }, - } + }, ); } }; @@ -137,12 +137,12 @@ watch( () => [addressData.value.for_me, isShow.value], ([newValue, newValue2]) => { if (!isEditing.value) { - addressData.value.phone = newValue == "بله" && newValue2 ? account.value?.phone ?? "" : ""; + addressData.value.phone = newValue == "بله" && newValue2 ? (account.value?.phone ?? "") : ""; } }, { immediate: true, - } + }, ); @@ -283,6 +283,9 @@ watch( > به عنوان آدرس پیش فرض ثبت شود؟ + + + (); // computed const value = computed({ - get: () => (modelValue.value == "true" ? true : false), + get: () => modelValue.value, set: (value) => { emit("update:modelValue", value); }, diff --git a/frontend/components/profile/index/ProfilePictureModal.vue b/frontend/components/profile/index/ProfilePictureModal.vue index d9af18d..48eed3b 100644 --- a/frontend/components/profile/index/ProfilePictureModal.vue +++ b/frontend/components/profile/index/ProfilePictureModal.vue @@ -12,7 +12,7 @@ type Props = { }; type Emits = { - "update:modelValue": [value: File]; + "update:modelValue": [value: File | null]; "update:isShow": [value: boolean]; }; @@ -59,8 +59,7 @@ const { isPending: updateAccountIsPending } = useUpdateAccount(); // computed const currentProfile = computed({ - get: () => - !!modelValue.value ? URL.createObjectURL(modelValue.value) : null, + get: () => (!!modelValue.value ? URL.createObjectURL(modelValue.value) : null), set: (value: File) => emit("update:modelValue", value), }); @@ -81,6 +80,15 @@ onFileDialogChange((files: any) => { emit("update:modelValue", file); resetFileDialog(); }); + +const resetAvatarFile = async () => { + const response = await fetch("/img/default-avatar.jpeg"); + const blob = await response.blob(); + const file = new File([blob], "default-avatar.jpeg", { type: blob.type }); + + emit("update:modelValue", file); + resetFileDialog(); +};