feat(usage): show Zed plan quota on the dashboard
Add a Zed usage handler so connected Zed accounts appear on /dashboard/quota. Reads GET /client/users/me for plan, edit predictions, optional hosted model requests and billing-cycle reset. Render unlimited rows as "N used · Unlimited" instead of 0 / ∞, and surface overdue-invoice / token-billing messages.
This commit is contained in:
@@ -172,8 +172,8 @@ function getSystemId(credentials) {
|
||||
);
|
||||
}
|
||||
|
||||
async function fetchJson(url, options) {
|
||||
const res = await proxyAwareFetch(url, options);
|
||||
async function fetchJson(url, options, proxyOptions = null) {
|
||||
const res = await proxyAwareFetch(url, options, proxyOptions);
|
||||
const text = await res.text();
|
||||
let data = null;
|
||||
if (text) {
|
||||
@@ -203,11 +203,15 @@ export async function fetchZedAuthenticatedUser(credentials, options = {}) {
|
||||
const systemId = getSystemId(credentials);
|
||||
if (systemId) headers[ZED_HEADERS.systemId] = systemId;
|
||||
|
||||
return fetchJson(zedUrl(config, "cloudBaseUrl", "/client/users/me", ZED_CLOUD_BASE_URL), {
|
||||
method: "GET",
|
||||
headers,
|
||||
signal: options.signal ?? undefined,
|
||||
});
|
||||
return fetchJson(
|
||||
zedUrl(config, "cloudBaseUrl", "/client/users/me", ZED_CLOUD_BASE_URL),
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
signal: options.signal ?? undefined,
|
||||
},
|
||||
options.proxyOptions ?? null,
|
||||
);
|
||||
}
|
||||
|
||||
function normalizeOrganizationId(value) {
|
||||
|
||||
Reference in New Issue
Block a user