Skip to content

Commit

Permalink
Add nextjs support
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldon-welinga committed May 10, 2022
1 parent a08774a commit 8277c06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/Cookie.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
type Options = {
interface Options {
expires?: Date;
path?: string;
domain?: string;
secure?: boolean;
};
}

export const encode = window.encodeURIComponent;
export const decode = window.decodeURIComponent;
export const encode = global?.window?.encodeURIComponent;
export const decode = global?.window?.decodeURIComponent;

export default class Cookie {
private doc: Partial<Document> | undefined | string;
Expand Down Expand Up @@ -101,6 +101,6 @@ export default class Cookie {
};
}

// const cookie = new Cookie(document);
// export const Cookies = Cookie;
// export default cookie;
// const cookie = new Cookie(global?.window?.document);
// export const Cookies = Cookie;
// export default cookie;
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Cookie from './Cookie';
const cookie = new Cookie(document);
const cookie = new Cookie(global?.window?.document);
export default cookie;

0 comments on commit 8277c06

Please sign in to comment.