Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

444 B
Raw Blame
import { NewsArticle } from "@/ui/layout/sidebar/news";
import { cache } from "react";

export const getContentAPI: () => Promise<{
  latestNewsArticles: NewsArticle[];
}> = cache(async () => {
  try {
    return await fetch("https://dub.co/api/content", {
      next: {
        revalidate: 60 * 60 * 24, // cache for 24 hours
      },
    }).then((res) => res.json());
  } catch (e) {
    return {
      latestNewsArticles: [],
    };
  }
});