Skip to content

Commit 4d1f6be

Browse files
committed
refactor project structure
1 parent bd6f00c commit 4d1f6be

25 files changed

+1362
-1049
lines changed

src/api.ts

+16-703
Large diffs are not rendered by default.

src/components/AutoCreateForm.vue

+5-6
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@
7373

7474
<script setup lang="ts">
7575
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'
7779
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
78-
import { getTypeName, transition } from './utils'
80+
import { getTypeName, transition } from '@/utils'
7981
import { ApiResult, HttpMethods, humanize, map } from '@servicestack/client'
8082
8183
const props = withDefaults(defineProps<{
@@ -105,7 +107,7 @@ const emit = defineEmits<{
105107
function update(value:ApiRequest) {
106108
}
107109
108-
const { typeOf, typeProperties, Crud } = useAppMetadata()
110+
const { typeOf, typeProperties, Crud, createDto, formValues } = useAppMetadata()
109111
110112
const typeName = computed(() => typeof props.type == 'string'
111113
? props.type
@@ -141,16 +143,13 @@ async function save(e:Event) {
141143
if (HttpMethods.hasRequestBody(method)) {
142144
let requestDto = new model.value.constructor()
143145
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)
146146
if (!returnsVoid) {
147147
api.value = await client.apiForm(requestDto, formData, { jsconfig: 'eccn' })
148148
} else {
149149
api.value = await client.apiFormVoid(requestDto, formData, { jsconfig: 'eccn' })
150150
}
151151
} else {
152152
let fieldValues = formValues(form, typeProperties(metaType.value))
153-
console.log('fieldValues', fieldValues)
154153
let requestDto = new model.value.constructor(fieldValues)
155154
if (!returnsVoid) {
156155
api.value = await client.api(requestDto, { jsconfig: 'eccn' })

0 commit comments

Comments
 (0)