fix(admin): persist image quota by setting remaining directly
Use PUT setImageQuota so admins can lower remaining below the stored plan limit; grant-only bonus updates silently no-op when bonus is already zero. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1373,6 +1373,22 @@ export async function fetchUserImageQuota(userId: string) {
|
||||
}>(`/admin-api/users/${userId}/image-quota`);
|
||||
}
|
||||
|
||||
export async function setUserImageQuota(
|
||||
userId: string,
|
||||
payload: { remaining?: number; total?: number },
|
||||
note = '',
|
||||
) {
|
||||
return portalFetch<{
|
||||
ok: boolean;
|
||||
unchanged?: boolean;
|
||||
subscription: AdminSubscription;
|
||||
quota: ImageQuotaView;
|
||||
}>(`/admin-api/users/${userId}/image-quota`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ ...payload, note }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function grantUserImageQuota(userId: string, delta: number, note = '') {
|
||||
return portalFetch<{
|
||||
ok: boolean;
|
||||
|
||||
Reference in New Issue
Block a user