Skip to content

Commit

Permalink
Update types.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Jun 20, 2024
1 parent 19d5ac0 commit b1024c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
13 changes: 0 additions & 13 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,6 @@ export interface WebsiteStats {
totalTime: { value: number; change: number };
}

export interface RealtimeInit {
websites: Website[];
token: string;
data: RealtimeUpdate;
}

export interface RealtimeUpdate {
pageviews: any[];
sessions: any[];
events: any[];
timestamp: number;
}

export interface DateRange {
value: string;
startDate: Date;
Expand Down
7 changes: 2 additions & 5 deletions src/pages/api/realtime/[websiteId].ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { startOfMinute, subMinutes } from 'date-fns';
import { canViewWebsite } from 'lib/auth';
import { useAuth, useValidate } from 'lib/middleware';
import { NextApiRequestQueryBody, RealtimeInit } from 'lib/types';
import { NextApiRequestQueryBody } from 'lib/types';
import { NextApiResponse } from 'next';
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
import { getRealtimeData } from 'queries';
Expand All @@ -20,10 +20,7 @@ const schema = {
}),
};

export default async (
req: NextApiRequestQueryBody<RealtimeRequestQuery>,
res: NextApiResponse<RealtimeInit>,
) => {
export default async (req: NextApiRequestQueryBody<RealtimeRequestQuery>, res: NextApiResponse) => {
await useAuth(req, res);
await useValidate(schema, req, res);

Expand Down

0 comments on commit b1024c7

Please sign in to comment.