+
);
}
diff --git a/samples/todo/pages/index.tsx b/samples/todo/pages/index.tsx
index 3e13551af..57a35f2db 100644
--- a/samples/todo/pages/index.tsx
+++ b/samples/todo/pages/index.tsx
@@ -1,38 +1,30 @@
import type { NextPage } from 'next';
-import { useSession, signIn } from 'next-auth/react';
import Spaces from 'components/Spaces';
import Link from 'next/link';
+import { useCurrentUser } from '@lib/context';
const Home: NextPage = () => {
- const { data: session, status: sessionStatus } = useSession();
-
- if (sessionStatus === 'unauthenticated') {
- // kick back to signin
- signIn();
- }
-
- if (!session) {
- return
Loading ...
;
- }
-
+ const user = useCurrentUser();
return (
<>
-
-
- Welcome {session.user.name || session.user.email}!
-
-
-
- Choose a space to start, or{' '}
-
-
- create a new one.
-
-
-
-
+ {user && (
+
+
+ Welcome {user.name || user.email}!
+
+
-
+ )}
>
);
};
diff --git a/samples/todo/pages/space/[slug]/[listId]/index.tsx b/samples/todo/pages/space/[slug]/[listId]/index.tsx
index 948660073..40752a3b2 100644
--- a/samples/todo/pages/space/[slug]/[listId]/index.tsx
+++ b/samples/todo/pages/space/[slug]/[listId]/index.tsx
@@ -68,7 +68,7 @@ export default function TodoList() {
-
+
{todos?.map((todo) => (
) => setTitle(e.currentTarget.value)}
@@ -120,7 +121,7 @@ export default function SpaceHome() {
const space = useContext(SpaceContext);
const { find } = useList();
- const lists = find({
+ const { data: lists, mutate: invalidateLists } = find({
where: {
space: {
id: space?.id,
@@ -151,9 +152,12 @@ export default function SpaceHome() {