ENGLISH·COURSE API
    Preparing search index...
    • Sends the learner to another page once their profile status matches a rule.

      Parameters

      • status: "unknown" | "absent" | "present"

        The learner profile status to judge

      • rule: LearnerRedirectRule

        The status that triggers the redirect, and its target path

      Returns void

      The personal pages are guarded on the client, because only the browser knows whether this device holds a profile. Nothing is decided while the status is unknown, so no page flashes a redirect during hydration.

      replace rather than push: the guarded page was never somewhere the learner meant to be, so Back should not return to it.

      const learner = useLearnerProfile();
      useLearnerRedirect(learner.status, { when: "absent", to: "/start" });