aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/components/FeedSidebar.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-14 11:52:56 +0900
committernsfisis <nsfisis@gmail.com>2026-02-14 11:53:08 +0900
commit2889b562e64993482bd13fd806af8ed0865bab8b (patch)
tree39400ac4d994fb33d2c544e7d4b9d98f8ecbd86a /frontend/src/components/FeedSidebar.tsx
parente216c3bc97994b4172d15d52b46d5f6b75f35ea4 (diff)
downloadfeedaka-2889b562e64993482bd13fd806af8ed0865bab8b.tar.gz
feedaka-2889b562e64993482bd13fd806af8ed0865bab8b.tar.zst
feedaka-2889b562e64993482bd13fd806af8ed0865bab8b.zip
refactor: migrate API from GraphQL to REST (TypeSpec/OpenAPI)
Replace the entire GraphQL stack (gqlgen, urql, graphql-codegen) with a TypeSpec → OpenAPI 3.x pipeline using oapi-codegen for Go server stubs and openapi-fetch + openapi-typescript for the frontend client. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'frontend/src/components/FeedSidebar.tsx')
-rw-r--r--frontend/src/components/FeedSidebar.tsx30
1 files changed, 21 insertions, 9 deletions
diff --git a/frontend/src/components/FeedSidebar.tsx b/frontend/src/components/FeedSidebar.tsx
index 73d9504..4f50566 100644
--- a/frontend/src/components/FeedSidebar.tsx
+++ b/frontend/src/components/FeedSidebar.tsx
@@ -1,23 +1,35 @@
-import { useQuery } from "urql";
+import { useCallback, useEffect, useState } from "react";
import { useLocation, useSearch } from "wouter";
-import { GetFeedsDocument } from "../graphql/generated/graphql";
+import type { components } from "../api/generated";
+import { api } from "../services/api-client";
+
+type Feed = components["schemas"]["Feed"];
interface Props {
basePath: string;
}
-const urqlContextFeed = { additionalTypenames: ["Feed", "Article"] };
-
export function FeedSidebar({ basePath }: Props) {
const search = useSearch();
const [, setLocation] = useLocation();
const params = new URLSearchParams(search);
const selectedFeedId = params.get("feed");
- const [{ data, fetching }] = useQuery({
- query: GetFeedsDocument,
- context: urqlContextFeed,
- });
+ const [feeds, setFeeds] = useState<Feed[]>([]);
+ const [fetching, setFetching] = useState(true);
+
+ const fetchFeeds = useCallback(async () => {
+ setFetching(true);
+ const { data } = await api.GET("/api/feeds");
+ if (data) {
+ setFeeds(data);
+ }
+ setFetching(false);
+ }, []);
+
+ useEffect(() => {
+ fetchFeeds();
+ }, [fetchFeeds]);
const handleSelect = (feedId: string | null) => {
if (feedId) {
@@ -49,7 +61,7 @@ export function FeedSidebar({ basePath }: Props) {
{fetching && (
<li className="px-3 py-1.5 text-xs text-stone-400">Loading...</li>
)}
- {data?.feeds.map((feed) => (
+ {feeds.map((feed) => (
<li key={feed.id}>
<button
type="button"