Observable of Invite

Example (React)

import { useObservable } from "dexie-react-hooks";
import { db } from "./db.js";

function MyComponent() {
  // db.cloud.invites is an Observable of Invite[] array.
  const invites = useObservable(db.cloud.invites);

  return (
        {invites.map((invite) => (
          <li key={invite.id}>
            You are invited to act as {invite.roles?.join(", ")}
            in the realm {invite.realm.name}
            <button onClick={() => invite.accept()}>Accept</button>
            <button onClick={() => invite.reject()}>Reject</button>

This component would render the current invites for your user at any time and re-render whenever an invite is added, updated or removed.

See useObservable()

Example (Svelte)

  import { db } from "./db.js";

  let oInvites = db.cloud.invites;

  {#each $oInvites as invite (invite.id)}

See Also

db.cloud properties