Fix bug
When the user clicks a project on /projects, and then clicks "New task" the project that has been clicked should persist to the "New task" page.
This commit is contained in:
parent
97486320cb
commit
a34c48b26c
1 changed files with 8 additions and 0 deletions
|
@ -16,6 +16,14 @@ export function App({ children }: PropsWithChildren<{}>) {
|
|||
const cookies = Object.fromEntries(
|
||||
document.cookie.split(";").map(e => e.split("=")),
|
||||
);
|
||||
/* allowlist: param keys acceptable as cookie keys */
|
||||
const allowlist = ["projectId"];
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (allowlist.includes(key) && cookies[key] !== value &&
|
||||
/^[0-9A-Za-z]+$/.test(String(value))) {
|
||||
document.cookie = `${key}=${value}; path=/`;
|
||||
}
|
||||
});
|
||||
return (
|
||||
<AppContext.Provider value={{ params, cookies }}>
|
||||
<ApolloProvider client={client}>{children}</ApolloProvider>
|
||||
|
|
Loading…
Reference in a new issue