add day 26
This commit is contained in:
24
day25/src/components/cookieInput.devto
Normal file
24
day25/src/components/cookieInput.devto
Normal file
@@ -0,0 +1,24 @@
|
||||
<div class="mb-2">
|
||||
<h2 class="text-xl font-semibold text-center">Username cookie is: {appState.contents.cookie}</h2>
|
||||
</div>
|
||||
<div class="flex justify-center flex-col">
|
||||
<input placeholder="username..."
|
||||
class="py-2 px-4 resize-none bg-zinc-800 rounded-md shadow-md my-2 border border-zinc-800 placeholder:italic placeholder:text-gray-300"
|
||||
d-model="cookiedata" />
|
||||
<button class="bg-blue-600 font-semibold rounded-md py-1 px-2 text-sm"
|
||||
d-on:click="appState.contents.cookie = appState.contents.cookiedata; setCookie('username', appState.contents.cookiedata, '365');">Submit
|
||||
Cookie</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
if (isSSR()) {
|
||||
appState.contents.cookie = getCookie('username')
|
||||
} else {
|
||||
console.log('waiting for client to finish load')
|
||||
document.addEventListener('router:client:load', () => {
|
||||
appState.contents.cookie = getCookie('username')
|
||||
console.log('done')
|
||||
})
|
||||
}
|
||||
console.log(getCookie('username'))
|
||||
</script>
|
||||
Reference in New Issue
Block a user