Files
directus/app/src/interfaces/index.ts
Oreille 9c9e2eff5b Fix ability to change M2O field type and prevent incompatible interfaces in advanced mode (#10096)
* Fix ability to change M2O field type and prevent incompatible interfaces in advanced mode

* Removed unused imports

* Rename interface variable
2021-12-01 16:16:37 -05:00

14 lines
535 B
TypeScript

import { shallowRef, Ref } from 'vue';
import { InterfaceConfig } from '@directus/shared/types';
const interfacesRaw: Ref<InterfaceConfig[]> = shallowRef([]);
const interfaces: Ref<InterfaceConfig[]> = shallowRef([]);
export function getInterfaces(): { interfaces: Ref<InterfaceConfig[]>; interfacesRaw: Ref<InterfaceConfig[]> } {
return { interfaces, interfacesRaw };
}
export function getInterface(name?: string | null): InterfaceConfig | undefined {
return !name ? undefined : interfaces.value.find(({ id }) => id === name);
}