From 7439109d1eee5db3a85e7384c404c60523057da1 Mon Sep 17 00:00:00 2001 From: sgotur Date: Mon, 21 Oct 2024 13:21:02 -0400 Subject: [PATCH] Update App.tsx --- src/App.tsx | 87 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 14 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index d7a72df3..74ebab1a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,10 +1,12 @@ import { useEffect, useState } from "react"; import type { Schema } from "../amplify/data/resource"; import { generateClient } from "aws-amplify/data"; +import { useAuthenticator } from '@aws-amplify/ui-react'; const client = generateClient(); function App() { + const { signOut } = useAuthenticator(); const [todos, setTodos] = useState>([]); useEffect(() => { @@ -17,21 +19,78 @@ function App() { client.models.Todo.create({ content: window.prompt("Todo content") }); } + function deleteTodo(id: string) { + client.models.Todo.delete({ id }) + } + + return ( -
-

My todos

- -
    - {todos.map((todo) => ( -
  • {todo.content}
  • - ))} -
-
- 🥳 App successfully hosted. Try creating a new todo. -
- - Review next step of this tutorial. - + +
+ +
+

Q Business Embedding

+
+ +
+

Things todo

+
+ +
+ + +
    + {todos.map((todo) => ( +
  • deleteTodo(todo.id)} key={todo.id}>{todo.content}
  • + ))} +
+
+ +
+

Powered Q Business

+ +
+ +
+
);