Save the username and password, show an alert to prove it.

This commit is contained in:
Eli Ribble 2024-08-27 10:18:24 -07:00
parent 9ff63d96fd
commit c6400d58d3
2 changed files with 12 additions and 7 deletions

View file

@ -22,7 +22,9 @@ const App = () => {
//setUsers(data)
});
};
const doLogin = (username: string, password: string) => {
alert("I be authin '" + username)
};
const loadAuth = () => {
const auth = localStorage.getItem("auth");
if (!auth) return;
@ -40,7 +42,7 @@ const App = () => {
return (
<div className="App">
{state ? <p>{state.username}</p> : <AuthModal doLogin={() => alert("login")}></AuthModal>}
{state ? <p>{state.username}</p> : <AuthModal doLogin={doLogin}></AuthModal>}
</div>
);
};