added revalidate tag for toss route

This commit is contained in:
Ilgeldi 2025-02-10 18:23:33 +05:00
parent 55cf8f593f
commit f035fd03cc
5 changed files with 21 additions and 10 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
NEXT_PRIVATE_DEBUG_CACHE=1

View File

@ -27,6 +27,7 @@ export async function authenticateLottery(phone: string, code: string) {
const result = await res.json();
console.log("Data fetched successfully " + res.status);
return result;
} catch (err) {
console.log(err);
@ -34,6 +35,6 @@ export async function authenticateLottery(phone: string, code: string) {
}
}
export const revalidateTagName = (tag: string) => {
export const revalidateTagName = async (tag: string) => {
revalidateTag(tag);
};

View File

@ -22,6 +22,7 @@ import { VideoModel } from "@/models/video.model";
import { VideosModel } from "@/models/videos.model";
import { IVote } from "@/models/vote.model";
import routes from "@/routes";
import { revalidateTag } from "next/cache";
import { cookies } from "next/headers";
export class Queries {
@ -270,7 +271,12 @@ export const getTossData = async ({
id: string;
}) => {
try {
const res = await fetch(`${baseUrl.QUIZ_SRC}${routes.tossId(type, id)}`);
const res = await fetch(`${baseUrl.QUIZ_SRC}${routes.tossId(type, id)}`, {
next: {
revalidate: 300,
tags: ["lotteryData"],
},
});
if (!res.ok) {
return undefined;

View File

@ -1,6 +1,5 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
reactStrictMode: false,
images: {

View File

@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 4000",
"dev": "next dev --turbopack -p 4000",
"build": "next build",
"start": "next start",
"lint": "next lint"
@ -22,8 +22,8 @@
"@tanstack/react-query": "^4.32.0",
"@tanstack/react-query-devtools": "^4.32.0",
"@types/node": "18.15.13",
"@types/react": "^18.2.15",
"@types/react-dom": "18.0.11",
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3",
"@types/uuid": "^9.0.1",
"autoprefixer": "10.4.14",
"axios": "^1.5.1",
@ -33,13 +33,13 @@
"dayjs": "^1.11.7",
"framer-motion": "^10.12.16",
"lucide-react": "^0.408.0",
"next": "^14.1.0",
"next": "15.1.6",
"next-seo": "^6.0.0",
"postcss": "8.4.23",
"react": "^18.2.0",
"react": "19.0.0",
"react-confetti": "^6.1.0",
"react-day-picker": "^8.10.1",
"react-dom": "^18.2.0",
"react-dom": "19.0.0",
"react-fast-marquee": "^1.3.5",
"react-hook-form": "^7.54.2",
"react-icons": "^4.8.0",
@ -60,6 +60,10 @@
"devDependencies": {
"@types/date-fns": "^2.6.0",
"eslint": "8.49.0",
"eslint-config-next": "^14.1.0"
"eslint-config-next": "15.1.6"
},
"overrides": {
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3"
}
}