cleanup
This commit is contained in:
parent
92779d8b4e
commit
feb6c7e2c9
2 changed files with 0 additions and 61 deletions
|
|
@ -20,7 +20,6 @@ const Impostazioni: NextPageWithLayout = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<StripeSection />
|
<StripeSection />
|
||||||
{/* <RedisCacheSection /> */}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
@ -71,45 +70,3 @@ const StripeSection = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// const RedisCacheSection = () => {
|
|
||||||
// const { data, isLoading } = api.revalidation.getRedisStats.useQuery();
|
|
||||||
// const utils = api.useUtils();
|
|
||||||
// const { mutate } = api.revalidation.invalidateRedisCache.useMutation({
|
|
||||||
// onMutate() {
|
|
||||||
// toast.loading("Invalidating cache...", {
|
|
||||||
// id: "invalidate-cache",
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// onSuccess: async () => {
|
|
||||||
// toast.success("Cache invalidated successfully!", {
|
|
||||||
// id: "invalidate-cache",
|
|
||||||
// });
|
|
||||||
// await utils.revalidation.getRedisStats.invalidate();
|
|
||||||
// },
|
|
||||||
// onError() {
|
|
||||||
// toast.error("Failed to invalidate cache.", {
|
|
||||||
// id: "invalidate-cache",
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// if (isLoading) {
|
|
||||||
// return <LoadingPage />;
|
|
||||||
// }
|
|
||||||
// return (
|
|
||||||
// <div className="space-y-4 rounded-lg border p-4">
|
|
||||||
// <h4 className="font-semibold text-lg">Invalidate Redis Cache</h4>
|
|
||||||
// <p>Current Cache Stats:</p>
|
|
||||||
// {data?.success ? (
|
|
||||||
// <ul className="list-inside list-disc">
|
|
||||||
// <li>Pdf Schede Annuncio: {data?.schedaCount}</li>
|
|
||||||
// <li>Pdf Condizioni: {data?.condizioniCount}</li>
|
|
||||||
// </ul>
|
|
||||||
// ) : (
|
|
||||||
// <div className="text-red-500">Error fetching cache stats</div>
|
|
||||||
// )}
|
|
||||||
|
|
||||||
// <Button onClick={() => mutate()}>Invalidate Cache</Button>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
|
||||||
|
|
@ -130,22 +130,4 @@ export const revalidationRouter = createTRPCRouter({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
getRedisStats: adminProcedure.query(async () => {
|
|
||||||
return "await getCacheStats();";
|
|
||||||
}),
|
|
||||||
invalidateRedisCache: adminProcedure.mutation(async () => {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
status: "success",
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Invalidate Redis cache error:", err);
|
|
||||||
throw new TRPCError({
|
|
||||||
code: "INTERNAL_SERVER_ERROR",
|
|
||||||
message:
|
|
||||||
err instanceof Error ? err.message : "Invalidate Redis cache failed",
|
|
||||||
cause: err,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue