|
73 | 73 |
|
74 | 74 | <script setup lang="ts">
|
75 | 75 | import type { ApiRequest, ApiResponse, ResponseStatus } from '@/types'
|
76 |
| -import { useAppMetadata, Css, createDto, formValues, useClient } from '@/api' |
| 76 | +import { useClient } from '@/api' |
| 77 | +import { useAppMetadata } from '@/metadata' |
| 78 | +import { Css } from '@/css' |
77 | 79 | import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
78 |
| -import { getTypeName, transition } from './utils' |
| 80 | +import { getTypeName, transition } from '@/utils' |
79 | 81 | import { ApiResult, HttpMethods, humanize, map } from '@servicestack/client'
|
80 | 82 |
|
81 | 83 | const props = withDefaults(defineProps<{
|
@@ -105,7 +107,7 @@ const emit = defineEmits<{
|
105 | 107 | function update(value:ApiRequest) {
|
106 | 108 | }
|
107 | 109 |
|
108 |
| -const { typeOf, typeProperties, Crud } = useAppMetadata() |
| 110 | +const { typeOf, typeProperties, Crud, createDto, formValues } = useAppMetadata() |
109 | 111 |
|
110 | 112 | const typeName = computed(() => typeof props.type == 'string'
|
111 | 113 | ? props.type
|
@@ -141,16 +143,13 @@ async function save(e:Event) {
|
141 | 143 | if (HttpMethods.hasRequestBody(method)) {
|
142 | 144 | let requestDto = new model.value.constructor()
|
143 | 145 | let formData = new FormData(form)
|
144 |
| - let file = Array.from(form.elements).find(x => (x as any).type == 'file') as HTMLInputElement |
145 |
| - console.log('formData', formData, file, file?.files?.length) |
146 | 146 | if (!returnsVoid) {
|
147 | 147 | api.value = await client.apiForm(requestDto, formData, { jsconfig: 'eccn' })
|
148 | 148 | } else {
|
149 | 149 | api.value = await client.apiFormVoid(requestDto, formData, { jsconfig: 'eccn' })
|
150 | 150 | }
|
151 | 151 | } else {
|
152 | 152 | let fieldValues = formValues(form, typeProperties(metaType.value))
|
153 |
| - console.log('fieldValues', fieldValues) |
154 | 153 | let requestDto = new model.value.constructor(fieldValues)
|
155 | 154 | if (!returnsVoid) {
|
156 | 155 | api.value = await client.api(requestDto, { jsconfig: 'eccn' })
|
|
0 commit comments