Compare commits

..

No commits in common. "3bf841d25943521dc59bd7341a86d03147254b08" and "d9477e9eaf564d3a8b6225af28fdbd6b3ab5060c" have entirely different histories.

5 changed files with 10 additions and 13 deletions
src/app
login
logout
settings
signup
u/[slug]

View file

@ -42,8 +42,8 @@ export default function UserPage() {
const response = await fetch(
process.env.NEXT_PUBLIC_MODE === "PROD"
? "https://d2jam.com/api/v1/session"
: "http://localhost:3005/api/v1/session",
? "https://d2jam.com/api/v1/login"
: "http://localhost:3005/api/v1/login",
{
body: JSON.stringify({ username: username, password: password }),
method: "POST",

View file

@ -9,9 +9,9 @@ export default function UserPage() {
async function logout() {
const response = await fetch(
process.env.NEXT_PUBLIC_MODE === "PROD"
? "https://d2jam.com/api/v1/session"
: "http://localhost:3005/api/v1/session",
{ method: "DELETE", credentials: "include" }
? "https://d2jam.com/api/v1/logout"
: "http://localhost:3005/api/v1/logout",
{ method: "POST", credentials: "include" }
);
if (response.ok) {

View file

@ -91,14 +91,12 @@ export default function UserPage() {
bio: sanitizedBio,
profilePicture: profilePicture,
bannerPicture: bannerPicture,
targetUserSlug: user.slug,
}),
method: "PUT",
headers: {
"Content-Type": "application/json",
authorization: `Bearer ${getCookie("token")}`,
},
credentials: "include",
}
);

View file

@ -68,8 +68,8 @@ export default function UserPage() {
const response = await fetch(
process.env.NEXT_PUBLIC_MODE === "PROD"
? "https://d2jam.com/api/v1/user"
: "http://localhost:3005/api/v1/user",
? "https://d2jam.com/api/v1/signup"
: "http://localhost:3005/api/v1/signup",
{
body: JSON.stringify({ username: username, password: password }),
method: "POST",

View file

@ -14,11 +14,10 @@ export default function UserPage() {
const fetchUser = async () => {
const response = await fetch(
process.env.NEXT_PUBLIC_MODE === "PROD"
? `https://d2jam.com/api/v1/user?targetUserSlug=${slug}`
: `http://localhost:3005/api/v1/user?targetUserSlug=${slug}`
? `https://d2jam.com/api/v1/user?slug=${slug}`
: `http://localhost:3005/api/v1/user?slug=${slug}`
);
const { data } = await response.json();
setUser(data);
setUser(await response.json());
};
fetchUser();