'vue' import { generateClient } from 'aws-amplify/data' import type { Schema, Todo } from '@/../amplify/data/resource' const client = generateClient<Schema>() const todos = ref<Todo[]>([]) async function createTodo() { const content = window.prompt("Todo content?"); if (content) { await client.models.Todo.create({ content, }); fetchTodos(); // Todo } } async function fetchTodos() { const { data, errors } = await client.models.Todo.list(); if (!errors) { todos.value = data; // todos } else { console.error(errors); // 力 } } // fetchTodos 行 onMounted(fetchTodos); </script> っ amplify/data/resource.ts const schema = a.schema({ Todo: a .model({ content: a.string() }) .authorization([a.allow.owner()]) }) export type Schema = ClientSchema<typeof schema> export const data = defineData({ schema, authorizationModes: { defaultAuthorizationMode: 'userPool' } })