Do not split cookie if it does not exist
This commit is contained in:
parent
fb0fd9b0da
commit
305b7a58e9
11
index.html
11
index.html
|
@ -119,7 +119,16 @@
|
|||
/**
|
||||
* (De)selects signatures based on the selection stored in a cookie.
|
||||
*/
|
||||
const loadSelectedSignaturesFromCookie = () => setSelectedSignatures(Cookies.get("selectedSignatures").split(","));
|
||||
const loadSelectedSignaturesFromCookie = () => {
|
||||
const cookie = Cookies.get("selectedSignatures");
|
||||
let signatures;
|
||||
if (cookie === undefined)
|
||||
signatures = [];
|
||||
else
|
||||
signatures = cookie.split(",");
|
||||
|
||||
setSelectedSignatures(signatures);
|
||||
};
|
||||
|
||||
/**
|
||||
* Saves the currently-selected signatures to a cookie.
|
||||
|
|
Loading…
Reference in New Issue