2023-01-17 08:27:17 +00:00
|
|
|
import "./App.css";
|
|
|
|
import {
|
|
|
|
UserEventSignIn,
|
|
|
|
SignInPayloadPB,
|
2023-01-26 07:40:23 +00:00
|
|
|
} from "../services/backend/events/flowy-user/index";
|
2023-01-17 08:27:17 +00:00
|
|
|
import { nanoid } from "nanoid";
|
2023-01-27 09:17:51 +00:00
|
|
|
import { UserNotificationListener } from "./components/user/application/notifications";
|
2023-01-17 08:27:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
function App() {
|
2023-01-27 09:17:51 +00:00
|
|
|
async function sendSignInEvent() {
|
2023-01-17 08:27:17 +00:00
|
|
|
let make_payload = () =>
|
|
|
|
SignInPayloadPB.fromObject({
|
|
|
|
email: nanoid(4) + "@gmail.com",
|
|
|
|
password: "A!@123abc",
|
|
|
|
name: "abc",
|
|
|
|
});
|
2023-01-27 09:17:51 +00:00
|
|
|
|
2023-01-27 14:57:23 +00:00
|
|
|
let listener = await new UserNotificationListener({
|
|
|
|
onUserSignIn: (userProfile) => {
|
2023-01-27 09:17:51 +00:00
|
|
|
console.log(userProfile);
|
2023-01-27 14:57:23 +00:00
|
|
|
}, onProfileUpdate(userProfile) {
|
|
|
|
console.log(userProfile);
|
|
|
|
// stop listening the changes
|
2023-01-27 09:17:51 +00:00
|
|
|
listener.stop();
|
2023-01-27 14:57:23 +00:00
|
|
|
}});
|
2023-01-27 09:17:51 +00:00
|
|
|
|
|
|
|
listener.start();
|
|
|
|
|
2023-01-17 08:27:17 +00:00
|
|
|
await UserEventSignIn(make_payload());
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="container">
|
|
|
|
<h1>Welcome to AppFlowy!</h1>
|
2023-01-27 09:17:51 +00:00
|
|
|
<button type="button" onClick={() => sendSignInEvent()}>
|
|
|
|
Test Sign In Event
|
2023-01-17 08:27:17 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|