Skip to content

Commit

Permalink
Rename the login handlers
Browse files Browse the repository at this point in the history
To make it clearer which is used in prod / dev
  • Loading branch information
alex9smith committed Nov 22, 2024
1 parent a80e784 commit e4661d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { jwtDecode } from "jwt-decode";
function Login() {
const navigate = useNavigate();

async function handleSuccess(response) {
function productionLoginHandler(response) {
const user = jwtDecode(response.credential);
authenticationService.setUser(user);
navigate("/");
}

function loginHandler() {
function developmentLoginHandler() {
authenticationService.setUser({
name: "Test",
given_name: "Test",
Expand All @@ -25,9 +25,9 @@ function Login() {
}

const loginButton = isProduction() ? (
<GoogleLogin onSuccess={handleSuccess} onError={console.log} />
<GoogleLogin onSuccess={productionLoginHandler} onError={console.log} />
) : (
<Button onClick={loginHandler}>Login</Button>
<Button onClick={developmentLoginHandler}>Login</Button>
);
return (
<PageLayout padding={"none"} containerWidth="full">
Expand Down

0 comments on commit e4661d8

Please sign in to comment.