## Cookies API

### Methods

- `get(name: string): string | object | any[]`
  Get cookie
  Params:
    - `name` (string, required)
      Cookie name
      Examples: `'userId'`
  Returns: `string | object | any[]`
    Cookie value, decoded; a JSON cookie is parsed into its Object or Array; Returns null if cookie not found
    Examples: `'john12'`, `{ theme: 'dark' }`
- `getAll(): object`
  Get all cookies
  Returns: `object`
    Object with cookie names (as keys) and their values, decoded and parsed as get() returns them
    Examples:
      - `{ userId: 'john12', XFrame: 'x534' }`
- `set(name: string, value: string | number | boolean | object | any[], options?: object): void`
  Set cookie
  Params:
    - `name` (string, required)
      Cookie name
      Examples: `'userId'`
    - `value` (string | number | boolean | object | any[], required)
      Cookie value; an Object or Array is stored as JSON and parsed back by get(); anything else reads back as a String
      Examples: `'john12'`, `{ theme: 'dark' }`
    - `options` (object, optional)
      Cookie options
      Object shape:
        - `expires` (number | string | Date, optional)
          Cookie expires detail; If specified as Number, then the unit is days; If specified as String, it can either be raw stringified date or in Xd Xh Xm Xs format (see examples)
          Examples:
            - `30`
            - `'Wed, 13 Jan 2021 22:23:01 GMT'`
            - `'1d'`
            - `'15m'`
            - `'13d'`
            - `'1d 15m'`
            - `'1d 3h 5m 3s'`
        - `path` (string, optional)
          Cookie path
          Examples: `'/accounts'`
        - `domain` (string, optional)
          Cookie domain
          Examples: `'.foo.com'`
        - `sameSite` (string, optional)
          SameSite cookie option
          Accepts: `'Lax'`, `'Strict'`, `'None'`
        - `httpOnly` (boolean, optional)
          Is cookie Http Only?
        - `secure` (boolean, optional)
          Is cookie secure? (https only)
        - `other` (string, optional)
          Raw string for other cookie options; To be used as a last resort for possible newer props that are currently not yet implemented in Quasar
          Examples: `'SomeNewCookieProp'`
- `has(name: string): boolean`
  Check if cookie exists
  Params:
    - `name` (string, required)
      Cookie name
      Examples: `'userId'`
  Returns: `boolean`
    Does cookie exists or not?
- `remove(name: string, options?: object): void`
  Remove a cookie
  Params:
    - `name` (string, required)
      Cookie name
      Examples: `'userId'`
    - `options` (object, optional)
      Cookie options; a cookie is removed only by a write carrying the same path and domain it was set with, and a __Secure- or __Host- prefixed one needs secure as well
      Object shape:
        - `path` (string, optional)
          Cookie path
          Examples: `'/accounts'`
        - `domain` (string, optional)
          Cookie domain
          Examples: `'.foo.com'`
        - `sameSite` (string, optional)
          SameSite cookie option
          Accepts: `'Lax'`, `'Strict'`, `'None'`
        - `httpOnly` (boolean, optional)
          Is cookie Http Only?
        - `secure` (boolean, optional)
          Is cookie secure? (https only)
        - `other` (string, optional)
          Raw string for other cookie options; To be used as a last resort for possible newer props that are currently not yet implemented in Quasar
          Examples: `'SomeNewCookieProp'`
- `useCookie(name: string, options?: object): object`
  Get a Vue ref bound to a cookie: it reads the cookie value (the default, or null, while missing), assigning it stores the value (null removes the cookie, or resets it to the default) and a nested change of an Object or Array value gets stored too. It follows the changes made through set()/remove(), through other refs of the same cookie and, where the browser has the Cookie Store API, those made by the server or another tab/window. It is released together with the calling scope (a component, a Pinia store, an effectScope()); outside of one, call its stop() method when done
  Params:
    - `name` (string, required)
      Cookie name
      Examples: `'theme'`
    - `options` (object, optional)
      Ref options, followed by the cookie options every write from the ref uses (see set())
      Object shape:
        - `default` (Function, optional)
          Returns the value the ref reads while the cookie is missing; called when the ref is created and each time the ref takes the default again (a null assignment, a removal), so that an Object or Array default is a fresh one every time; the value gets stored when the ref attaches to a missing cookie (on the client only) and again whenever the cookie is removed
          Function signature: `() => string | object | any[]`
          Examples: `() => 'light'`, `() => ({ notifications: true })`
          Returns: `string | object | any[]`
            The default value
        - `deep` (boolean, optional), default `true`
          Hand out an Object or Array value reactive, so that a nested change gets tracked and persisted; set it to false for a value that you only ever assign as a whole
        - `disabled` (boolean | object | Function, optional)
          While true the ref is detached from the cookie (a plain in-memory ref); once false again it attaches like a new ref: the stored value wins if the cookie exists, otherwise the current value gets stored
          Examples: `true`, `() => consent.value !== true`
        - `expires` (number | string | Date, optional)
          Cookie expires detail; If specified as Number, then the unit is days; If specified as String, it can either be raw stringified date or in Xd Xh Xm Xs format (see examples)
          Examples:
            - `30`
            - `'Wed, 13 Jan 2021 22:23:01 GMT'`
            - `'1d'`
            - `'15m'`
            - `'13d'`
            - `'1d 15m'`
            - `'1d 3h 5m 3s'`
        - `path` (string, optional)
          Cookie path
          Examples: `'/accounts'`
        - `domain` (string, optional)
          Cookie domain
          Examples: `'.foo.com'`
        - `sameSite` (string, optional)
          SameSite cookie option
          Accepts: `'Lax'`, `'Strict'`, `'None'`
        - `httpOnly` (boolean, optional)
          Is cookie Http Only?
        - `secure` (boolean, optional)
          Is cookie secure? (https only)
        - `other` (string, optional)
          Raw string for other cookie options; To be used as a last resort for possible newer props that are currently not yet implemented in Quasar
          Examples: `'SomeNewCookieProp'`
  Returns: `object`
    A Vue ref with an extra stop() method that detaches it from the cookie
- `parseSSR(ssrContext: object): object`
  For SSR/SSG usage only, and only on the global import (not on $q.cookies)
  Params:
    - `ssrContext` (object, required)
      SSR Context Object
  Returns: `object`
    Cookie object (like $q.cookies) for SSR/SSG usage purposes

### Vue Injection

Accessible via `$q.cookies` (e.g., `this.$q.cookies` in Options API or `useQuasar().cookies` in Composition API).

