templatized storymaking
This commit is contained in:
1 parent
02ec81c16a
commit
a9c3e9c890
9 files changed
+255
-172
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { useState } from "react";
|
||||
import { useCookies } from "react-cookie";
|
||||
|
||||
export const useAutomationManagerState = () => {
|
||||
const [
|
||||
cookies,
|
||||
setCookies,
|
||||
// eslint-disable-next-line
|
||||
_,
|
||||
] = useCookies(["selectedAutomation"]);
|
||||
let initialCurrent = null;
|
||||
try {
|
||||
initialCurrent = cookies.selectedAutomation ?? null;
|
||||
} catch (_) {}
|
||||
|
||||
const [current, setCurrent] = useState<string | null>(initialCurrent);
|
||||
|
||||
return {
|
||||
current,
|
||||
setCurrent(i: string | null) {
|
||||
setCurrent(i);
|
||||
setCookies("selectedAutomation", i === null ? undefined : i);
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user