39 lines
953 B
TypeScript
39 lines
953 B
TypeScript
export interface Session {
|
|
id: string;
|
|
ip_address: string;
|
|
user_agent: string;
|
|
created_at: string;
|
|
last_activity: string;
|
|
is_current?: boolean;
|
|
}
|
|
|
|
const MOCK_SESSIONS: Session[] = [
|
|
{
|
|
id: 's1',
|
|
ip_address: '192.168.1.1',
|
|
user_agent: 'Chrome on MacOS',
|
|
created_at: '2023-10-01',
|
|
last_activity: 'Just now',
|
|
is_current: true,
|
|
},
|
|
{
|
|
id: 's2',
|
|
ip_address: '10.0.0.5',
|
|
user_agent: 'Safari on iPhone',
|
|
created_at: '2023-10-05',
|
|
last_activity: '2 days ago',
|
|
is_current: false,
|
|
},
|
|
];
|
|
|
|
export const sessionService = {
|
|
getSessions: async () => {
|
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
return { sessions: MOCK_SESSIONS };
|
|
},
|
|
logoutSession: async () => Promise.resolve(),
|
|
logoutAll: async () => Promise.resolve(),
|
|
revokeSession: async (_id: string) => Promise.resolve(),
|
|
getStats: async () =>
|
|
Promise.resolve({ total_sessions: 2, active_sessions: 1 }),
|
|
};
|