Claptrap-ui/src/stores/coockiesStorage.ts
2022-05-24 23:04:35 +02:00

24 lines
386 B
TypeScript

import Cookies from "js-cookie";
export const cookiesStorage: Storage = {
length: 0,
clear() {
return;
},
key(index) {
return null;
},
removeItem(key) {
Cookies.remove(key);
},
setItem(key, state) {
return Cookies.set(key, state, {
expires: 7,
sameSite: "strict",
});
},
getItem(key) {
return Cookies.get(key) as string;
},
};