Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
Updated example with resetUserPassword
Browse files Browse the repository at this point in the history
  • Loading branch information
dilan-dio4 committed May 9, 2021
1 parent abad931 commit ae58937
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example/src/ProjectUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function ProjectUser() {
signUp,
signOut,
getUserAttributes,
resetUserPassword,
onSignIn,
db
} = useEasybase();
Expand Down Expand Up @@ -51,13 +52,21 @@ export default function ProjectUser() {
setData(res as Record<string, any>[]);
}

const resetPassword = async () => {
const new_pass = prompt("Enter new password", "");
if (!new_pass) return;
console.log(await resetUserPassword(new_pass));
signOut();
}

if (isUserSignedIn()) {
return (
<div style={{ display: "flex", width: '100vw', height: '90vh', justifyContent: 'center', alignItems: 'center', flexDirection: "column" }}>
<div style={{ display: "flex", flexDirection: "column", backgroundColor: "#BBB", padding: 40, borderRadius: 5 }}>
<button className="btn green m-4" onClick={onUserAttrsClick}><span>Get user attrs</span></button>
<button className="btn orange m-4" onClick={signOut}><span>Sign Out</span></button>
<button className="btn orange m-4" onClick={addUserRecord}><span>Add User Record</span></button>
<button className="btn orange m-4" onClick={resetPassword}><span>Reset Password</span></button>
</div>
<div className="d-flex">
{data.map((ele, index) => <DbCardElement {...ele} tableName="REACT TEST" key={index} />)}
Expand Down

0 comments on commit ae58937

Please sign in to comment.