#access cookie delivered from server

15 messages · Page 1 of 1 (latest)

untold furnace
#

I have this cookie delivered from a separate backend: (Img 1)

I tried to access it using a composable: (img 2)

but I got a 500 defineEventHandler is not defined

mint furnace
#

Img2 does not show a composable, it shows a server api route.

#

Where is this code saved in your project?

#

And are you trying to access the cookie on the client oder server side?

untold furnace
mint furnace
#

Yeah but your code shows a backend route, can you show the frontend code where you try to access it?

untold furnace
#
<script setup>
import id64 from '@/composables/idCookie'
</script>
<template>
  <div>{{ id64 }} </div>
 </template>
#

this probably is completely wrong, I thought the getCookie was a way to access cookies on the client side

mint furnace
#

No it's server side

#

useCookie is client side

#

You are trying to define a server backend api route as a frontend composable

#

The docs are generally a very good way to learn nuxt3 🙂

untold furnace
#

Thank you sm, I shouldve read it better