Skip to content

Commit 3f3b818

Browse files
committed
jk reverted fr now
1 parent bd8f461 commit 3f3b818

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

app/locations/[location]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function Page({ params }: { params: { location: number } }) {
1414
const [foodReviews, setFoodReviews] = useState<FrontEndReviews | null>(null);
1515

1616
useEffect(() => {
17-
fetchLocations().then(async (locations: Location[]) => {
17+
fetchLocations().then((locations: Location[]) => {
1818
if (params.location < 0 || params.location >= locations.length) {
1919
return <h1>Location not found</h1>;
2020
}

app/profile/page.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ interface User {
1111
picture: string;
1212
}
1313
import Image from "next/image";
14-
import { useCookies } from 'next-client-cookies';
1514
const imageWidth = 100;
1615
const imageHeight = 100;
1716

@@ -32,13 +31,12 @@ const Page = () => {
3231
const handleLogout = () => {
3332
googleLogout();
3433
axios
35-
.post("http://localhost:8000/myapi/logout/")
34+
.post("http://localhost:8000/api/logout/")
3635
.then((res) => console.log("Backend logout successful", res))
3736
.catch((err) => console.error("Backend logout failed", err));
3837

39-
// Remove the stored user login token
38+
// Remove the token from sessionStorage
4039
sessionStorage.removeItem("token");
41-
sessionStorage.removeItem("email");
4240
// Redirect the user to the main page after logging out
4341
window.location.href = "/";
4442
console.log("Logged out successfully");
@@ -49,7 +47,12 @@ const Page = () => {
4947
<h1>Profile</h1>
5048
{user && (
5149
<div>
52-
<Image src={user.picture} alt="User profile" width={imageWidth} height={imageHeight}/>
50+
<Image
51+
src={user.picture}
52+
alt="User profile"
53+
width={imageWidth}
54+
height={imageHeight}
55+
/>
5356
<h2>
5457
Welcome, {user.name} - {user.email}
5558
</h2>

components/login.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { useEffect, useState } from "react";
33
import { GoogleOAuthProvider, useGoogleLogin } from "@react-oauth/google";
44
import axios from "axios";
55
import { GOOGLE_CLIENT_ID } from "@/private/secrets";
6-
import Cookies from 'js-cookie';
76

87
interface User {
98
name: string;
@@ -19,8 +18,6 @@ const LoginPage = () => {
1918
};
2019

2120
const LoginComponent = () => {
22-
const [user, setUser] = useState<User | null>(null);
23-
2421
useEffect(() => {
2522
console.log("LoginPage component mounted");
2623
}, []);
@@ -30,9 +27,8 @@ const LoginComponent = () => {
3027

3128
onSuccess: (tokenResponse) => {
3229
console.log(tokenResponse);
33-
// Store authentication token
30+
// Store authentication token in the browser's storage for navigation bar use
3431
sessionStorage.setItem("token", tokenResponse.access_token);
35-
3632
// Redirect the user to main page
3733
window.location.href = "/";
3834
//handleLoginSuccess

0 commit comments

Comments
 (0)