export const getSessionData = async () => {
try {
const headersList = await headers();
const [session, activeSessions] = await Promise.all([
auth.api.getSession({ headers: headersList }),
auth.api.listSessions({ headers: headersList }),
]);
return {
session,
activeSessions,
isAuthenticated: !!session,
};
} catch (error) {
console.error("Error in getSessionData:", error);
return {
session: null,
activeSessions: [],
isAuthenticated: false,
};
}
};
export const getSessionData = async () => {
try {
const headersList = await headers();
const [session, activeSessions] = await Promise.all([
auth.api.getSession({ headers: headersList }),
auth.api.listSessions({ headers: headersList }),
]);
return {
session,
activeSessions,
isAuthenticated: !!session,
};
} catch (error) {
console.error("Error in getSessionData:", error);
return {
session: null,
activeSessions: [],
isAuthenticated: false,
};
}
};