diff options
Diffstat (limited to 'pages/testing.js')
| -rw-r--r-- | pages/testing.js | 34 |
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, + }, + }; +} |