From 648c2a4e0bd8d8300c25144fa022bedde6736652 Mon Sep 17 00:00:00 2001 From: Rijk van Zanten Date: Mon, 11 May 2020 13:23:41 -0400 Subject: [PATCH] Add user interface (#549) --- src/interfaces/index.ts | 2 + src/interfaces/user/index.ts | 10 + src/interfaces/user/user.vue | 424 ++++++++++++++++++ .../components/modal-detail/modal-detail.vue | 8 +- 4 files changed, 441 insertions(+), 3 deletions(-) create mode 100644 src/interfaces/user/index.ts create mode 100644 src/interfaces/user/user.vue diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 9d83fa4057..5c915ae593 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -17,6 +17,7 @@ import InterfaceManyToOne from './many-to-one'; import InterfaceOneToMany from './one-to-many'; import InterfaceHash from './hash'; import InterfaceSlug from './slug'; +import InterfaceUser from './user'; export const interfaces = [ InterfaceTextInput, @@ -38,6 +39,7 @@ export const interfaces = [ InterfaceOneToMany, InterfaceHash, InterfaceSlug, + InterfaceUser, ]; export default interfaces; diff --git a/src/interfaces/user/index.ts b/src/interfaces/user/index.ts new file mode 100644 index 0000000000..38895b1336 --- /dev/null +++ b/src/interfaces/user/index.ts @@ -0,0 +1,10 @@ +import InterfaceUser from './user.vue'; +import { defineInterface } from '@/interfaces/define'; + +export default defineInterface(({ i18n }) => ({ + id: 'user', + name: i18n.t('user'), + icon: 'person', + component: InterfaceUser, + options: [], +})); diff --git a/src/interfaces/user/user.vue b/src/interfaces/user/user.vue new file mode 100644 index 0000000000..3d9595d1ae --- /dev/null +++ b/src/interfaces/user/user.vue @@ -0,0 +1,424 @@ + + + + + diff --git a/src/views/private/components/modal-detail/modal-detail.vue b/src/views/private/components/modal-detail/modal-detail.vue index 08b8b92170..4110fd9385 100644 --- a/src/views/private/components/modal-detail/modal-detail.vue +++ b/src/views/private/components/modal-detail/modal-detail.vue @@ -111,10 +111,12 @@ export default defineComponent({ loading.value = true; + const endpoint = props.collection.startsWith('directus_') + ? `/${currentProjectKey}/${props.collection.substring(9)}/${props.primaryKey}` + : `/${currentProjectKey}/items/${props.collection}/${props.primaryKey}`; + try { - const response = await api.get( - `/${currentProjectKey}/items/${props.collection}/${props.primaryKey}` - ); + const response = await api.get(endpoint); item.value = response.data.data; } catch (err) {