Skip to content

Commit

Permalink
add th redirecturl
Browse files Browse the repository at this point in the history
  • Loading branch information
Konzisam committed Dec 8, 2024
1 parent 88417fd commit 0fd55b3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import { useAuth } from "react-oidc-context";
import Home from "./components/Home";
import { useNavigate } from "react-router-dom";
import { useEffect } from "react";
// import { config } from "./config/env";
import { config } from "./config/env";

// const { client_id, localURL: logoutUri, cognitoDomain } = config;
const { client_id, localURL: logoutUri, cognitoDomain } = config;

function App() {
const auth = useAuth();
const navigate = useNavigate();

console.log(auth);

// const signOutRedirect = () => {
// sessionStorage.clear();
const signOutRedirect = () => {
sessionStorage.clear();

// window.location.href = `${cognitoDomain}/logout?client_id=${client_id}&logout_uri=${encodeURIComponent(
// logoutUri
// )}`;
// };
window.location.href = `${cognitoDomain}/logout?client_id=${client_id}&logout_uri=${encodeURIComponent(
logoutUri
)}`;
};

useEffect(() => {
if (auth.isAuthenticated) {
Expand Down Expand Up @@ -56,7 +56,7 @@ function App() {
<h1>Car Price Estimator</h1>
<h3>Please Login to use</h3>
<button onClick={() => auth.signinRedirect()}>Sign in / Register</button>
{/* <button onClick={() => signOutRedirect()}>Sign out</button> */}
<button onClick={() => signOutRedirect()}>Sign out</button>
</div>
);
}
Expand Down

0 comments on commit 0fd55b3

Please sign in to comment.