WarningLegacy version 5 documentation. View current documentation.

useAuthSimulator API

The useAuthSimulator hook can be used to test authentication components.

Function Name type Summary
sendToServer function A method to simulate sending username and password to a back end server. This method requires two argumnents: sendToServer("username","password"). If either argument is missing or blank then {error: "Error text"} will be returned. Otherwise, {result: "ok"} will be returned.

Usage

import { useAuthSimulator } from "@finsemble/finsemble-ui/react/hooks";

const Authentication = () => {
  const { sendToServer } = useAuthSimulator();

  ...
  const response = await sendToServer(payload.username, payload.password);
  ...
};