22 lines
719 B
TypeScript
22 lines
719 B
TypeScript
import { apiRequest } from './api'
|
|||
|
|
import type { Card } from '../types'
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set the contents and order of one column -- the inbox (both null) or a
|
||
|
|
* project's status (both set). Shared by the sidebar's inbox list and a
|
||
|
|
* project's kanban columns, since either can be a drag source or target for
|
||
|
|
* the other (dragging a card in re-parents it; its old column is re-packed
|
||
|
|
* server-side).
|
||
|
|
*/
|
||
|
|
export async function reorderColumn(
|
||
|
|
projectId: number | null,
|
||
|
|
statusId: number | null,
|
||
|
|
cardIds: number[],
|
||
|
|
): Promise<{ cards: Card[] }> {
|
||
|
|
return apiRequest<{ cards: Card[] }>('/cards/order', {
|
||
|
|
method: 'PUT',
|
||
|
|
auth: true,
|
||
|
|
body: { project_id: projectId, status_id: statusId, card_ids: cardIds },
|
||
|
|
})
|
||
|
|
}
|