Skip to content

Commit 770fa7f

Browse files
committed
chore: fix typesctipt error across spa[3]
1 parent b78b2b3 commit 770fa7f

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

adminforth/spa/src/components/ResourceListTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
:row="row"
210210
:resource="resource"
211211
:adminUser="coreStore.adminUser"
212-
@callAction="(payload? : Object) => startCustomAction(action.id, row, payload)"
212+
@callAction="(payload? : Object) => startCustomAction(action.id as string | number, row, payload)"
213213
>
214214
<button
215215
type="button"

adminforth/spa/src/stores/core.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,10 @@ import { callAdminForthApi } from '@/utils';
44
import websocket from '@/websocket';
55
import { useAdminforth } from '@/adminforth';
66

7-
import type { AdminForthResourceCommon, AdminForthResourceColumnCommon, GetBaseConfigResponse, ResourceVeryShort, AdminUser, UserData, AdminForthConfigMenuItem, AdminForthConfigForFrontend, AdminForthActionFront, AdminForthBulkActionFront } from '@/types/Common';
7+
import type { AdminForthResourceCommon, AdminForthResourceColumnCommon, GetBaseConfigResponse, ResourceVeryShort, AdminUser, UserData, AdminForthConfigMenuItem, AdminForthConfigForFrontend, AdminForthResourceFrontend } from '@/types/Common';
88
import type { Ref } from 'vue'
99

10-
type AdminforthOptionsCommon = AdminForthResourceCommon['options'];
1110

12-
interface AdminForthOptionsForFrontend extends Omit<AdminforthOptionsCommon, 'actions' | 'bulkActions'> {
13-
actions?: AdminForthActionFront[],
14-
bulkActions?: AdminForthBulkActionFront[],
15-
}
16-
interface AdminForthResourceFrontend extends Omit<AdminForthResourceCommon, 'options'> {
17-
options: AdminForthOptionsForFrontend;
18-
}
1911

2012
export const useCoreStore = defineStore('core', () => {
2113
const { alert } = useAdminforth();

adminforth/spa/src/views/LoginView.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
<component
3636
v-for="(c, index) in coreStore?.config?.loginPageInjections?.panelHeader || []"
3737
:key="index"
38-
:is="getCustomComponent(c)"
39-
:meta="c.meta"
38+
:is="getCustomComponent(formatComponent(c))"
39+
:meta="formatComponent(c).meta"
4040
/>
4141
</template>
4242
<h3 v-else class="text-xl font-semibold text-lightLoginViewText dark:text-darkLoginViewTextColor">
@@ -88,8 +88,8 @@
8888

8989
<component
9090
v-for="c in coreStore?.config?.loginPageInjections?.underInputs || []"
91-
:is="getCustomComponent(c)"
92-
:meta="c.meta"
91+
:is="getCustomComponent(formatComponent(c))"
92+
:meta="formatComponent(c).meta"
9393
@update:disableLoginButton="setDisableLoginButton($event)"
9494
/>
9595

@@ -107,8 +107,8 @@
107107
</Button>
108108
<component
109109
v-for="c in coreStore?.config?.loginPageInjections?.underLoginButton || []"
110-
:is="getCustomComponent(c)"
111-
:meta="c.meta"
110+
:is="getCustomComponent(formatComponent(c))"
111+
:meta="formatComponent(c).meta"
112112
@update:disableLoginButton="setDisableLoginButton($event)"
113113
/>
114114
</form>
@@ -124,7 +124,7 @@
124124

125125
<script setup lang="ts">
126126
127-
import { getCustomComponent } from '@/utils';
127+
import { getCustomComponent, formatComponent } from '@/utils';
128128
import { onBeforeMount, onMounted, ref, computed } from 'vue';
129129
import { useCoreStore } from '@/stores/core';
130130
import { useUserStore } from '@/stores/user';

adminforth/types/Common.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ export interface AdminForthBulkActionFront extends Omit<AdminForthBulkActionComm
322322
id: string,
323323
}
324324

325+
type AdminforthOptionsCommon = NonNullable<AdminForthResourceCommon['options']>;
326+
327+
export interface AdminForthOptionsForFrontend extends Omit<AdminforthOptionsCommon, 'actions' | 'bulkActions'> {
328+
actions?: AdminForthActionFront[],
329+
bulkActions?: AdminForthBulkActionFront[],
330+
}
331+
332+
export interface AdminForthResourceFrontend extends Omit<AdminForthResourceCommon, 'options'> {
333+
options: AdminForthOptionsForFrontend;
334+
}
335+
325336
/**
326337
* Resource describes one table or collection in database.
327338
* AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.

0 commit comments

Comments
 (0)