Skip to content

Commit bf3ea7b

Browse files
committed
refactor: clean up unused imports and move required column logic in saveRecord function
1 parent a8c1372 commit bf3ea7b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

adminforth/spa/src/components/ResourceForm.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
7272
import { applyRegexValidation, callAdminForthApi, loadMoreForeignOptions, searchForeignOptions, createSearchInputHandlers, checkShowIf } from '@/utils';
7373
import { computedAsync } from '@vueuse/core';
74-
import { computed, onMounted, reactive, ref, watch, provide, type Ref, watchEffect } from 'vue';
74+
import { computed, onMounted, reactive, ref, watch, provide, type Ref } from 'vue';
7575
import { useRouter, useRoute } from 'vue-router';
7676
import { useCoreStore } from "@/stores/core";
7777
import GroupsTable from '@/components/GroupsTable.vue';
@@ -84,7 +84,6 @@ const { t } = useI18n();
8484
8585
const mutex = new Mutex();
8686
87-
8887
const coreStore = useCoreStore();
8988
const router = useRouter();
9089
const route = useRoute();
@@ -372,7 +371,6 @@ watch(() => [editableColumns.value, props.validatingMode], async () => {
372371
});
373372
374373
if (props.validatingMode) {
375-
//Here I need to add debounce
376374
debouncedValidation(editableColumns.value);
377375
} else {
378376
isValidating.value = false;
@@ -424,7 +422,7 @@ provide('columnLoadingState', columnLoadingState);
424422
provide('onSearchInput', onSearchInput);
425423
provide('loadMoreOptions', loadMoreOptions);
426424
427-
watch(() => isValid.value, async (value) => {
425+
watch(() => isValid.value, (value) => {
428426
emit('update:isValid', value);
429427
});
430428

adminforth/spa/src/views/CreateView.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,6 @@ onMounted(async () => {
195195
});
196196
197197
async function saveRecord() {
198-
const requiredColumns = coreStore.resource?.columns.filter(c => c.required?.create === true) || [];
199-
const requiredColumnsToSkip = requiredColumns.filter(c => checkShowIf(c, record.value, coreStore.resource?.columns || []) === false);
200-
201198
const interceptorsResult = await saveRecordPreparations(
202199
'create',
203200
validatingMode,
@@ -211,6 +208,9 @@ async function saveRecord() {
211208
route
212209
);
213210
211+
const requiredColumns = coreStore.resource?.columns.filter(c => c.required?.create === true) || [];
212+
const requiredColumnsToSkip = requiredColumns.filter(c => checkShowIf(c, record.value, coreStore.resource?.columns || []) === false);
213+
214214
const interceptorConfirmationResult = (interceptorsResult.extra as Record<string, any>)?.confirmationResult;
215215
const response = await callAdminForthApi({
216216
method: 'POST',

0 commit comments

Comments
 (0)