aboutsummaryrefslogtreecommitdiff
path: root/pages/testing.js
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-04-13 22:14:50 +0700
committerFactiven <[email protected]>2023-04-13 22:14:50 +0700
commit5007e48c8546d8138092039bf3cecc0b9904a407 (patch)
tree8b27c6fce4dcde5d21c04b65e1f2059924532cb4 /pages/testing.js
parentUpdate index.js (diff)
downloadmoopa-5007e48c8546d8138092039bf3cecc0b9904a407.tar.xz
moopa-5007e48c8546d8138092039bf3cecc0b9904a407.zip
Update 4th
Diffstat (limited to 'pages/testing.js')
-rw-r--r--pages/testing.js30
1 files changed, 21 insertions, 9 deletions
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 <button onClick={() => handleUpdate()}>Click for update</button>;
+ return (
+ <div>
+ <button onClick={() => handleUpdate()}>Click for update</button>
+ {!session && (
+ <button onClick={() => signIn("AniListProvider")}>LOGIN</button>
+ )}
+ </div>
+ );
}
export async function getServerSideProps(context) {