fix(api,web): add workspace context to widgets and auto-detect workspace ID (#532)
All checks were successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/api Pipeline was successful

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #532.
This commit is contained in:
2026-02-27 04:53:07 +00:00
committed by jason.woltje
parent e3cba37e8c
commit edcff6a0e0
4 changed files with 43 additions and 62 deletions

View File

@@ -6,22 +6,24 @@ import Link from "next/link";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { fetchCredentials, type Credential } from "@/lib/api/credentials";
import { useWorkspaceId } from "@/lib/hooks";
export default function CredentialsPage(): React.ReactElement {
const [credentials, setCredentials] = useState<Credential[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const workspaceId = "default-workspace-id";
const workspaceId = useWorkspaceId();
useEffect(() => {
void loadCredentials();
}, []);
if (!workspaceId) return;
void loadCredentials(workspaceId);
}, [workspaceId]);
async function loadCredentials(): Promise<void> {
async function loadCredentials(wsId: string): Promise<void> {
try {
setIsLoading(true);
const response = await fetchCredentials(workspaceId);
const response = await fetchCredentials(wsId);
setCredentials(response.data);
setError(null);
} catch (err) {