Refactor CreateProductDialog and CreateStoreDialog components for improved form handling
- Remove unnecessary destructuring of form values in CreateProductDialog to simplify code. - Enhance conditional rendering in CreateStoreDialog to ensure proper checks for selected countries. - Update API request handling in CreateStoreDialog to enforce non-null assertions for required fields. - Adjust MerchantStore component to use underscore-prefixed parameters in event handlers for clarity. These changes streamline the form handling process and improve code readability across the components.
This commit is contained in:
parent
0c931cf457
commit
378e534a66
4 changed files with 11 additions and 12 deletions
|
|
@ -155,10 +155,10 @@
|
|||
</SelectContent>
|
||||
</Select>
|
||||
</FormControl>
|
||||
<div v-if="values.newZone?.selectedCountries?.length > 0" class="mt-2">
|
||||
<div v-if="values.newZone?.selectedCountries && values.newZone.selectedCountries.length > 0" class="mt-2">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
<Badge
|
||||
v-for="country in values.newZone.selectedCountries"
|
||||
v-for="country in (values.newZone?.selectedCountries || [])"
|
||||
:key="country"
|
||||
variant="secondary"
|
||||
class="text-xs"
|
||||
|
|
@ -211,7 +211,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch, nextTick } from 'vue'
|
||||
import { ref, computed, watch, nextTick } from 'vue'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import * as z from 'zod'
|
||||
|
|
@ -353,10 +353,10 @@ const addNewZone = async () => {
|
|||
const createdZone = await nostrmarketAPI.createZone(
|
||||
currentUser.wallets[0].adminkey,
|
||||
{
|
||||
name: newZone.name,
|
||||
currency: values.currency,
|
||||
cost: newZone.cost,
|
||||
countries: newZone.selectedCountries
|
||||
name: newZone.name!,
|
||||
currency: values.currency!,
|
||||
cost: newZone.cost!,
|
||||
countries: newZone.selectedCountries!
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue