♻️ Use the new composable instead of get event
This commit is contained in:
@@ -4,12 +4,9 @@ import { keysToCamel, keysToSnake } from "~/utils/transformKeys"
|
|||||||
export const useSolarNetwork = () => {
|
export const useSolarNetwork = () => {
|
||||||
const apiBase = useSolarNetworkUrl()
|
const apiBase = useSolarNetworkUrl()
|
||||||
|
|
||||||
// Access SSR request event only on the server
|
|
||||||
const event = import.meta.server ? useRequestEvent() : null
|
|
||||||
|
|
||||||
// Forward cookies from the incoming request
|
// Forward cookies from the incoming request
|
||||||
const headers: HeadersInit = import.meta.server && event
|
const headers: HeadersInit = import.meta.server
|
||||||
? { cookie: event.headers.get('cookie') ?? '' }
|
? useRequestHeaders()
|
||||||
: {}
|
: {}
|
||||||
|
|
||||||
return $fetch.create({
|
return $fetch.create({
|
||||||
|
|||||||
Reference in New Issue
Block a user