Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Commit

Permalink
Update Login.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
andrrsin committed May 7, 2023
1 parent 6b85428 commit b4163fc
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions webapp/src/pages/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ import {useState} from "react";
import {Button, Container, FormGroup, TextField} from "@mui/material";
import "./login.css"
import {LoginButton} from "@inrupt/solid-ui-react";

import { login } from "@inrupt/solid-client-authn-browser";
const Login = () => {
const [idp, setIdp] = useState("https://inrupt.net");

const handleSubmit = async (e:any) => {

e.preventDefault(); //if not used, the page will reload and data will be lost
login({
redirectUrl: "http://172.162.240.176:3000/main/", // after redirect, come to the actual page
oidcIssuer: idp, // redirect to the url
clientName: "Lo Map",
});
};

return (
<Container>
Expand All @@ -27,13 +36,16 @@ const Login = () => {
onChange={(e: any) => setIdp(e.target.value)}
InputProps={{
endAdornment: (
<LoginButton oidcIssuer={idp}
redirectUrl="http://172.162.240.176:3000/main/"
onError={console.error}>
<Button variant="contained">
// <LoginButton oidcIssuer={idp}
// redirectUrl="http://172.162.240.176:3000/main/"
// onError={console.error}>
<Button variant="contained" onClick={(e) => {
handleSubmit(e);

}}>
Login
</Button>
</LoginButton>
// </LoginButton>
),
}}
/>
Expand Down

0 comments on commit b4163fc

Please sign in to comment.