From 5007e48c8546d8138092039bf3cecc0b9904a407 Mon Sep 17 00:00:00 2001 From: Factiven Date: Thu, 13 Apr 2023 22:14:50 +0700 Subject: Update 4th --- pages/testing.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'pages/testing.js') diff --git a/pages/testing.js b/pages/testing.js index ffa8080..cae165a 100644 --- a/pages/testing.js +++ b/pages/testing.js @@ -1,26 +1,38 @@ -import { getUser } from "./api/getUser"; +import { getUser } from "./api/get-user"; +import { useSession, signIn } from "next-auth/react"; export default function Testing({ user }) { + const { data: session } = useSession(); async function handleUpdate() { - const res = await fetch("/api/update-user", { + const lastPlayed = { + id: "apahisya", + time: 812989929, + }; + const res = await fetch("/api/watched-episode", { method: "POST", body: JSON.stringify({ - name: "Factiven", - newData: { - settings: { - tracking: false, - }, - }, + username: session?.user.name, + id: 150672, + newData: lastPlayed, }), headers: { "Content-Type": "application/json", }, }); + // const data = await res.json(); // parse the response body as JSON + // console.log(data.dat.id); console.log(res.status); } console.log(user.settings); - return ; + return ( +
+ + {!session && ( + + )} +
+ ); } export async function getServerSideProps(context) { -- cgit v1.2.3