import fetchWrapper from "../fetchWrapper.js";
import getXSRFToken from "../getXSRF.js";

export default async function createTask({
                                             eventId,
                                             name,
                                             description,
                                             start,
                                             end,
                                             location,
                                             maxParticipants,
                                         }) {
    const csrfToken = await getXSRFToken();

    return fetchWrapper(
        "/api/events/task",
        {
            event_id: eventId,
            name,
            description,
            start,
            end,
            location,
            max_participants: maxParticipants,
        },
        "POST",
        {"X-XSRF-TOKEN": csrfToken}
    );
}
