Skip to content

Commit

Permalink
Merge pull request #7 from harshvg247/main
Browse files Browse the repository at this point in the history
Added loader and title
  • Loading branch information
Parth-Sinha authored Mar 7, 2024
2 parents 0b1a210 + 918bb51 commit 3b2ccc5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
7 changes: 5 additions & 2 deletions backend/controllers/urlControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ const get_click_short_url = async(req, res)=>{
}})
console.log(foundUrl)
if(foundUrl){

const redirectTo = "https://" + foundUrl.redirectedUrl
let redirectTo = "https://" + foundUrl.redirectedUrl;
if(foundUrl.redirectedUrl.slice(0, 5)=="https"){
redirectTo = foundUrl.redirectedUrl
}

return res.redirect(302, redirectTo)
}
// Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Expand Down
Binary file modified client/public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Slinkly</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
11 changes: 11 additions & 0 deletions client/src/components/Loader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion client/src/components/PrivateRoutes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Outlet, useNavigate } from 'react-router-dom';
import axios from 'axios';
import Loader from './Loader';

const PrivateRoute = () => {
const [isAuthenticated, setIsAuthenticated] = useState(false);
Expand Down Expand Up @@ -41,7 +42,7 @@ const PrivateRoute = () => {
}, [navigate, accessToken]);

if (isLoading) {
return <div>Loading...</div>;
return <Loader/>;
}

return isAuthenticated ? <Outlet /> : null;
Expand Down

0 comments on commit 3b2ccc5

Please sign in to comment.