it is a client component where i'm trying to perform the logout, yeah:
'use client'
import { useEffect } from 'react'
export default function Logout() {
useEffect(() => {
const logout = async () => {
const res = await fetch('/api/users/logout', {
method: 'POST',
credentials: 'include', //don't know if i need this
headers: {
'Content-Type': 'application/json',
},
})
console.log(res)
if (res.ok) {
console.log('logged u out')
} else {
console.log('broke')
}
}
logout()
}, [])
return (
<div>
<h1>Logout</h1>
<button onClick={() => {}}>Logout</button>
</div>
)
}