|
|
@@ -1,18 +1,26 @@
|
|
|
<template>
|
|
|
- <EditorCard
|
|
|
- name="character"
|
|
|
- :modelId="props.characterId"
|
|
|
- :action="props.action"
|
|
|
- :fields="characterFields"
|
|
|
- :initialValue="props.initialValue"
|
|
|
- :options="options"
|
|
|
- :isSaved="isSaved"
|
|
|
- :redirectBack="{ name: 'characters' }"
|
|
|
- :schema="schema"
|
|
|
- @create="create"
|
|
|
- @update="update"
|
|
|
- @delete="destroy"
|
|
|
- />
|
|
|
+ <div>
|
|
|
+ <SpinnerModal
|
|
|
+ v-if="isPending"
|
|
|
+ :visible="true"
|
|
|
+ />
|
|
|
+
|
|
|
+ <EditorCard
|
|
|
+ v-else
|
|
|
+ name="character"
|
|
|
+ :modelId="props.characterId"
|
|
|
+ :action="props.action"
|
|
|
+ :fields="characterFields"
|
|
|
+ :initialValue="props.initialValue"
|
|
|
+ :options="options"
|
|
|
+ :isSaved="isSaved"
|
|
|
+ :redirectBack="{ name: 'characters' }"
|
|
|
+ :schema="schema"
|
|
|
+ @create="create"
|
|
|
+ @update="update"
|
|
|
+ @delete="destroy"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
@@ -24,8 +32,9 @@ const props = defineProps({
|
|
|
},
|
|
|
|
|
|
characterId: {
|
|
|
- type: Number,
|
|
|
- validator: (value, props) => props.action === "create" || _isInteger(value)
|
|
|
+ type: String,
|
|
|
+ required: false,
|
|
|
+ validator: (value, props) => props.action === "create" || isPresent(value)
|
|
|
},
|
|
|
|
|
|
initialValue: {
|
|
|
@@ -40,7 +49,7 @@ const { createCharacter } = useCreateCharacter()
|
|
|
const { updateCharacter } = useUpdateCharacter()
|
|
|
const { deleteCharacter } = useDeleteCharacter()
|
|
|
|
|
|
-const { data: options } = useQuery(characterOptionsQuery)
|
|
|
+const { data: options, isPending } = useQuery(characterOptionsQuery)
|
|
|
|
|
|
const schema =
|
|
|
props.action === "create" ? createCharacterSchema : updateCharacterSchema
|