()
| 8 | const COOKIE_NAME = HOME_VIEW_COOKIE_NAME; |
| 9 | |
| 10 | function getHomeViewFromCookie(): HomeView { |
| 11 | if (typeof document === "undefined") { |
| 12 | return "search"; |
| 13 | } |
| 14 | const cookies = document.cookie.split(';').map(c => c.trim()); |
| 15 | const cookie = cookies.find(c => c.startsWith(`${COOKIE_NAME}=`)); |
| 16 | if (!cookie) { |
| 17 | return "search"; |
| 18 | } |
| 19 | const value = cookie.substring(`${COOKIE_NAME}=`.length); |
| 20 | return value === "ask" ? "ask" : "search"; |
| 21 | } |
| 22 | |
| 23 | function setHomeViewCookie(value: HomeView) { |
| 24 | if (typeof document === "undefined") { |
nothing calls this directly
no outgoing calls
no test coverage detected