changed directory
This commit is contained in:
+8
-25
@@ -1,9 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
// imports
|
||||
|
||||
import useCreateOrUpdateAddress, {
|
||||
type CreateOrUpdateAddressRequest,
|
||||
} from "~/composables/api/account/useCreateOrUpdateAddress";
|
||||
import useCreateOrUpdateAddress from "~/composables/api/account/useCreateOrUpdateAddress";
|
||||
import useGetAccount from "~/composables/api/account/useGetAccount";
|
||||
import { QUERY_KEYS } from "~/constants";
|
||||
import { useToast } from "~/composables/global/useToast";
|
||||
@@ -12,23 +10,13 @@ import { useToast } from "~/composables/global/useToast";
|
||||
|
||||
type Props = {
|
||||
address?: Address;
|
||||
isShow: boolean;
|
||||
};
|
||||
|
||||
type Emits = {
|
||||
"update:address": [value: File];
|
||||
"update:isShow": [value: boolean];
|
||||
};
|
||||
|
||||
// props
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const { address, isShow } = toRefs(props);
|
||||
|
||||
// emits
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
const { address } = toRefs(props);
|
||||
|
||||
// computed
|
||||
|
||||
@@ -40,7 +28,9 @@ const { $queryClient: queryClient } = useNuxtApp();
|
||||
|
||||
const { addToast } = useToast();
|
||||
|
||||
const addressData = ref<CreateOrUpdateAddressRequest>({
|
||||
const isShow = ref(false);
|
||||
|
||||
const addressData = ref({
|
||||
id: address.value?.id ?? undefined,
|
||||
province: address.value?.province ?? "",
|
||||
city: address.value?.city ?? "",
|
||||
@@ -64,13 +54,6 @@ const {
|
||||
isPending: createAddressIsPending,
|
||||
} = useCreateOrUpdateAddress(isEditing);
|
||||
|
||||
// computed
|
||||
|
||||
const visible = computed({
|
||||
get: () => isShow.value ?? false,
|
||||
set: (value: boolean) => emit("update:isShow", value),
|
||||
});
|
||||
|
||||
// methods
|
||||
|
||||
const closeModal = () => {
|
||||
@@ -86,7 +69,7 @@ const closeModal = () => {
|
||||
for_me: "بله",
|
||||
};
|
||||
}
|
||||
visible.value = false;
|
||||
isShow.value = false;
|
||||
};
|
||||
|
||||
const addNew = () => {
|
||||
@@ -138,7 +121,7 @@ watch(
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
v-model="visible"
|
||||
v-model="isShow"
|
||||
:title="!!address ? 'ویرایش آدرس' : 'افزودن آدرس'"
|
||||
:icon="!!address ? 'bi:pen' : 'ci:plus'"
|
||||
:iconSize="!!address ? '20' : '32'"
|
||||
@@ -151,7 +134,7 @@ watch(
|
||||
size="md"
|
||||
class="rounded-full"
|
||||
>
|
||||
<span class="font-bold whitespace-pre">
|
||||
<span class="whitespace-pre">
|
||||
{{ !!address ? "ویرایش آدرس" : "افزودن آدرس" }}
|
||||
</span>
|
||||
</Button>
|
||||
Reference in New Issue
Block a user