Files
Vector/apps/web/src/lib/api/bins.ts
T
josh 09d1d96cb4
CI / Lint · Typecheck · Test · Build (push) Successful in 49s
CI / Playwright (smoke) (push) Has been skipped
CI / Build & push images (push) Successful in 1m2s
feat(bins): clickable bin cards with dedicated detail page
Clicking a bin on Locations now navigates to /bins/:id, showing the
bin's site/room/name, created/updated metadata, and a paginated
DataTable of parts currently in the bin. Admins can rename or delete
the bin from the detail page; the BinGrid kebab menu still works
without triggering navigation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 15:17:55 -04:00

30 lines
943 B
TypeScript

import type { CreateBinRequest, UpdateBinRequest } from '@vector/shared';
import { api } from './client.js';
import { getList } from './paginated.js';
import type { Bin, BinWithPath } from './types.js';
export function listBins(
filters: { page?: number; pageSize?: number; roomId?: string; siteId?: string } = {},
) {
return getList<BinWithPath>('/bins', filters);
}
export async function getBin(id: string): Promise<BinWithPath> {
const res = await api.get<BinWithPath>(`/bins/${id}`);
return res.data;
}
export async function createBin(input: CreateBinRequest): Promise<BinWithPath> {
const res = await api.post<BinWithPath>('/bins', input);
return res.data;
}
export async function updateBin(id: string, input: UpdateBinRequest): Promise<Bin> {
const res = await api.patch<Bin>(`/bins/${id}`, input);
return res.data;
}
export async function deleteBin(id: string): Promise<void> {
await api.delete(`/bins/${id}`);
}