Skip to content

Commit

Permalink
timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
zstenger93 committed Apr 21, 2024
1 parent 80a4b3d commit c2d9423
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frontend/public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
counter--;
setTimeout(updateCounter, 1150);
} else {
window.location.href = '/Transcendence/';
window.location.href = '/';
}
}

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const PageWrapper = ({ children, image, showSidebar = true, redirectUri }) => {
function App() {
const { i18n } = useTranslation();
const basename = "";
// process.env.NODE_ENV === "production" ? "/Transcendence" : "";
let REDIRECT_URI;

if (process.env.NODE_ENV === "development") {
Expand Down Expand Up @@ -164,7 +163,7 @@ function App() {
</PageWrapper>
}
/>
<Route
<Route
path="tournament"
element={
<PageWrapper image={Background} redirectUri={REDIRECT_URI}>
Expand Down
20 changes: 16 additions & 4 deletions frontend/src/pages/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ import zsolt from "../images/about/zsolt.jpeg";
import jamshidbek from "../images/about/jamshidbek.jpg";
import karlis from "../images/about/karlis.png";
import laszlo from "../images/about/laszlo.png";
import Cookies from "js-cookie";

function About() {
useEffect(() => {
setTimeout(() => {
const accessToken = Cookies.get("access");
console.log(accessToken);

if (!accessToken) {
window.location.href = "/404.html";
}
}, 1000);
}, []);

const [selectedCard, setSelectedCard] = React.useState(null);
const { t } = useTranslation();
const teamMembers = [
Expand Down Expand Up @@ -121,10 +133,10 @@ function About() {
flex flex-col items-center justify-start transition-all duration-800
ease-in-out transform-gpu shadow-2xl
${
selectedCard === index
? "w-96 absolute top-1/2 transform -translate-y-1/2"
: ""
}`}
selectedCard === index
? "w-96 absolute top-1/2 transform -translate-y-1/2"
: ""
}`}
style={{
backgroundImage: `url(${backgroundImage})`,
transition: "transform 0.0s ease-in-out",
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/pages/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@ import {
unblockUser,
getBlockedUsers,
} from "../components/API";
import Cookies from "js-cookie";

function Chat({ redirectUri }) {
useEffect(() => {
setTimeout(() => {
const accessToken = Cookies.get("access");
console.log(accessToken);

if (!accessToken) {
window.location.href = "/404.html";
}
}, 1000);
}, []);

const { t } = useTranslation();
const navigate = useNavigate();
const [currentChannel, setCurrentChannel] = useState("General");
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/pages/Home.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* disable eslint */

import React from "react";
import React, { useEffect} from "react";
import WelcomeMessage from "../components/home/WelcomeMessage";
import Readme from "../components/home/Readme";
import Sidebar from "../components/hamburger_menu/Hamburger";
import Cookies from "js-cookie";

function ScrollDownIndicator() {
return (
Expand All @@ -16,6 +17,17 @@ function ScrollDownIndicator() {
}

function Home({ redirectUri }) {
useEffect(() => {
setTimeout(() => {
const accessToken = Cookies.get("access");
console.log(accessToken);

if (!accessToken) {
window.location.href = "/404.html";
}
}, 1000);
}, []);

return (
<>
<div className="relative h-screen flex items-center justify-center">
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/pages/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ const defaultUserDetails = {
};

function Profile({ redirectUri }) {
useEffect(() => {
setTimeout(() => {
const accessToken = Cookies.get("access");
console.log(accessToken);

if (!accessToken) {
window.location.href = "/404.html";
}
}, 1000);
}, []);

const [userDetails, setUserDetails] = useState(null);
const [imageUrl, setImageUrl] = useState(defaultUserDetails.profile_picture);
const [username, setUsername] = useState(
Expand All @@ -241,7 +252,7 @@ function Profile({ redirectUri }) {
.replace("('", "")
.replace("',)", "")
.replace("v2/", "")
.replace("api", "profile"),
.replace("api", "profile"),
};
});

Expand Down

0 comments on commit c2d9423

Please sign in to comment.