Skip to content

Commit

Permalink
add withOptions method to cookieStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
atk committed Mar 29, 2024
1 parent a8ae11b commit 55f5a39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/storage/src/cookies.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isServer, getRequestEvent, type RequestEvent } from "solid-js/web";
import { StorageProps, StorageSignalProps, StorageWithOptions } from "./types.js";
import { addClearMethod } from "./tools.js";
import { addClearMethod, addWithOptionsMethod } from "./tools.js";
import { createStorage, createStorageSignal } from "./storage.js";

export type CookieOptions = CookieProperties & {
Expand Down Expand Up @@ -79,7 +79,7 @@ const getResponseHeaders = isServer
* ```
* Also, you can use its _read and _write properties to change reading and writing
*/
export const cookieStorage: StorageWithOptions<CookieOptions> = addClearMethod({
export const cookieStorage: StorageWithOptions<CookieOptions> = addWithOptionsMethod(addClearMethod({
_read: isServer
? (options?: CookieOptions) => {
const requestCookies = (options?.getRequestHeaders?.() || getRequestHeaders()).get(
Expand Down Expand Up @@ -144,7 +144,7 @@ export const cookieStorage: StorageWithOptions<CookieOptions> = addClearMethod({
get length() {
return this.getLength();
},
});
}));

/**
* creates a reactive store but bound to document.cookie
Expand Down

0 comments on commit 55f5a39

Please sign in to comment.