mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-27 05:24:36 +00:00
fix: update news fetching endpoint and adjust NewsItem schema for nullable URL
This commit is contained in:
+1
-1
@@ -269,7 +269,7 @@ export async function fetchPlayerLeaderboard(
|
||||
|
||||
export async function getNews(): Promise<NewsItem[]> {
|
||||
try {
|
||||
const res = await fetch(`${getApiBase()}/news`, {
|
||||
const res = await fetch(`${getApiBase()}/news.json`, {
|
||||
headers: { Accept: "application/json" },
|
||||
});
|
||||
if (res.status !== 200) {
|
||||
|
||||
@@ -196,7 +196,7 @@ export const NewsItemSchema = z.object({
|
||||
id: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
url: z.string().optional(),
|
||||
url: z.string().nullable().optional(),
|
||||
type: z.enum(["tournament", "tutorial", "announcement"]),
|
||||
});
|
||||
export type NewsItem = z.infer<typeof NewsItemSchema>;
|
||||
|
||||
Reference in New Issue
Block a user