Skip to content

Commit ade380b

Browse files
author
UraniumKing007
committed
Add default return values for getStats when no latest stats are found
1 parent f3193ca commit ade380b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/server/get-stats.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,12 @@ export const getStats = createServerFn({ method: "GET" }).handler(async () => {
1313
.where(eq(stats.id, 1))
1414
.limit(1);
1515

16+
if (!latestStats) {
17+
return {
18+
whimsCreated: 0,
19+
secretsVanished: 0,
20+
};
21+
}
22+
1623
return latestStats;
1724
});

0 commit comments

Comments
 (0)