[web] sponsors: remove impression logging to Redis

This commit is contained in:
Yangshun 2025-04-08 16:28:32 +08:00
parent ed4b0d8e1b
commit e0c56695e4
2 changed files with 0 additions and 29 deletions

View File

@ -1,20 +0,0 @@
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
import nullthrows from 'nullthrows';
import RedisCounter from '~/redis/RedisCounter';
import { getErrorMessage } from '~/utils/getErrorMessage';
export async function POST(req: NextRequest) {
try {
const { a } = await req.json();
new RedisCounter('SPONSORSHIPS_AD_IMPRESSION', nullthrows(a)).incr();
return new NextResponse(null, { status: 204 });
} catch (error) {
console.error(error);
return NextResponse.json({ err: getErrorMessage(error) }, { status: 500 });
}
}

View File

@ -28,15 +28,6 @@ export default function useSponsorsAdImpressionLogging<T extends HTMLElement>(
ad_placement: adPlacement,
},
});
fetch(`/ads/impression`, {
body: JSON.stringify({
a: adId,
}),
headers: {
'Content-Type': 'application/json',
},
method: 'POST',
});
}, [adFormat, adId, adPlacement, isInView, pathname]);
return ref;