fix: use correct /api/auth/me endpoint for coffee page user detection
This commit is contained in:
@@ -54,8 +54,13 @@ export default function CoffeePage() {
|
|||||||
if (!res.ok) throw new Error('Failed to load menu');
|
if (!res.ok) throw new Error('Failed to load menu');
|
||||||
return res.json();
|
return res.json();
|
||||||
}),
|
}),
|
||||||
fetch('/api/auth/session').then(async (res) => {
|
fetch('/api/auth/me').then(async (res) => {
|
||||||
if (res.ok) return res.json();
|
if (res.ok) {
|
||||||
|
const data = await res.json();
|
||||||
|
if (data.authenticated && data.id) {
|
||||||
|
return { user: { id: data.id, username: data.username, role: data.role, first_name: data.first_name, last_name: data.last_name } };
|
||||||
|
}
|
||||||
|
}
|
||||||
return { user: null };
|
return { user: null };
|
||||||
}),
|
}),
|
||||||
fetch('/api/rooms').then(async (res) => {
|
fetch('/api/rooms').then(async (res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user