Skip to content

Commit 1373fe1

Browse files
committed
app:ref: use ListSessions type for listSessions queries
1 parent 45faac2 commit 1373fe1

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

apps/app/query/auth-query.client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {
22
ListApiKeys,
33
ListDeviceSessions,
4+
ListSessions,
45
ListUserAccounts,
56
Session,
67
} from '@deepcrawl/auth/types';
@@ -30,7 +31,7 @@ export async function getSession(): Promise<Session | null> {
3031
* Auth Client API Call:
3132
* all active sessions for the current user
3233
*/
33-
export async function listSessions(): Promise<Session['session'][]> {
34+
export async function listSessions(): Promise<ListSessions> {
3435
const { data: sessions, error } = await authClient.listSessions();
3536

3637
if (error) {

apps/app/query/auth-query.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { auth } from '@deepcrawl/auth/lib/auth';
44
import type {
55
ListApiKeys,
66
ListDeviceSessions,
7+
ListSessions,
78
ListUserAccounts,
89
Session,
910
} from '@deepcrawl/auth/types';
@@ -29,7 +30,7 @@ export async function authGetSession(): Promise<Session | null> {
2930
* Auth Server API Call:
3031
* all active sessions for the current user
3132
*/
32-
export async function authListSessions(): Promise<Session['session'][]> {
33+
export async function authListSessions(): Promise<ListSessions> {
3334
const requestHeaders = await headers();
3435

3536
try {

packages/auth/src/types/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import type { auth } from '@deepcrawl/auth/lib/auth';
44
export type Auth = typeof auth;
55
export type Session = typeof auth.$Infer.Session;
66

7+
/**
8+
* The type for listSessions
9+
*/
10+
export type ListSessions = Awaited<ReturnType<typeof auth.api.listSessions>>;
11+
712
/**
813
* The type for listUserAccounts
914
*/

0 commit comments

Comments
 (0)