mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
647 B
23 lines
647 B
import type { ProjectType, TableType } from "nocodb-sdk"; |
|
import { useNuxtApp } from "#app"; |
|
|
|
export default () => { |
|
const { $api } = useNuxtApp(); |
|
|
|
const project = useState<ProjectType>("project"); |
|
const tables = useState<Array<TableType>>("tables"); |
|
|
|
const loadTables = async () => { |
|
if (project.value.id) { |
|
const tablesResponse = await $api.dbTable.list(project.value.id); |
|
|
|
if (tablesResponse.list) tables.value = tablesResponse.list; |
|
} |
|
}; |
|
|
|
const loadProject = async (projectId: string) => { |
|
project.value = await $api.project.read(projectId); |
|
}; |
|
|
|
return { project, tables, loadProject, loadTables }; |
|
};
|
|
|