Function setCookie

  • Sets a client-side cookie. Useful for saving non-essential state to provide a better user experience. Note that some browser settings may prevent cookies from being saved, and users can clear browser cookies at any time, so cookies are not a substitute for database persistence.

    Parameters

    • name: string

      The name of the cookie to be saved.

    • value: string

      The value of the cookie to be saved.

    • pageOnly: boolean

      Whether this cookie should be scoped to the entire site, or just this page. Page scoping considers the entire URL without parameters; all URL contents after the '?' are ignored.

    • days: number

      The number of days the cookie should be saved on the client.

    Returns void