aboutsummaryrefslogtreecommitdiff
path: root/pages/testing.js
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-04-13 16:03:57 +0700
committerFactiven <[email protected]>2023-04-13 16:03:57 +0700
commitb365d89a11adf40d37b78292f121b890e960d0e8 (patch)
tree6bd745c773dc48a2e5e4c18d2f71d54d82d682fd /pages/testing.js
parentupdate 1 (diff)
downloadmoopa-b365d89a11adf40d37b78292f121b890e960d0e8.tar.xz
moopa-b365d89a11adf40d37b78292f121b890e960d0e8.zip
update 2nd
Diffstat (limited to 'pages/testing.js')
-rw-r--r--pages/testing.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/pages/testing.js b/pages/testing.js
new file mode 100644
index 0000000..ffa8080
--- /dev/null
+++ b/pages/testing.js
@@ -0,0 +1,34 @@
+import { getUser } from "./api/getUser";
+
+export default function Testing({ user }) {
+ async function handleUpdate() {
+ const res = await fetch("/api/update-user", {
+ method: "POST",
+ body: JSON.stringify({
+ name: "Factiven",
+ newData: {
+ settings: {
+ tracking: false,
+ },
+ },
+ }),
+ headers: {
+ "Content-Type": "application/json",
+ },
+ });
+ console.log(res.status);
+ }
+
+ console.log(user.settings);
+ return <button onClick={() => handleUpdate()}>Click for update</button>;
+}
+
+export async function getServerSideProps(context) {
+ const user = await getUser("Factiven");
+ console.log(user);
+ return {
+ props: {
+ user: user,
+ },
+ };
+}