mirror of
https://github.com/Ategon/Jamjar.git
synced 2025-02-12 06:16:21 +00:00
Fix sign up
This commit is contained in:
parent
7de5732596
commit
3df39a4405
2 changed files with 8 additions and 6 deletions
|
@ -60,7 +60,6 @@ export default function UserPage() {
|
|||
|
||||
const { user } = await response.json();
|
||||
const token = response.headers.get("Authorization");
|
||||
console.log(response.headers);
|
||||
|
||||
if (!token) {
|
||||
toast.error("Failed to retreive access token");
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { Button, Form, Input, Link } from "@nextui-org/react";
|
||||
import { redirect } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
export default function UserPage() {
|
||||
const [username, setUsername] = useState("");
|
||||
|
@ -72,6 +74,7 @@ export default function UserPage() {
|
|||
body: JSON.stringify({ username: username, password: password }),
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -81,13 +84,13 @@ export default function UserPage() {
|
|||
return;
|
||||
}
|
||||
|
||||
// const { token, user } = await response.json();
|
||||
// document.cookie = `token=${token}`;
|
||||
// document.cookie = `user=${user.slug}`;
|
||||
const { token, user } = await response.json();
|
||||
document.cookie = `token=${token}`;
|
||||
document.cookie = `user=${user.slug}`;
|
||||
|
||||
// toast.success("Successfully signed up");
|
||||
toast.success("Successfully signed up");
|
||||
|
||||
// redirect("/");
|
||||
redirect("/");
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
|
|
Loading…
Reference in a new issue