import Request from "superagent";


export const find = () => (
    Request.get(`/api/subtractions${window.location.search}`)
);

export const listIds = () => (
    Request.get("/api/subtractions")
        .query({ids: true})
);

export const get = ({ subtractionId }) => (
    Request.get(`/api/subtractions/${subtractionId}`)
);

export const create = ({ subtractionId, fileId, nickname }) => (
    Request.post("/api/subtractions")
        .send({
            subtraction_id: subtractionId,
            file_id: fileId,
            nickname
        })
);

export const update = ({ subtractionId, nickname }) => (
    Request.patch(`/api/subtractions/${subtractionId}`)
        .send({ nickname })
);

export const remove = ({ subtractionId }) => (
    Request.delete(`/api/subtractions/${subtractionId}`)
);

import Request from "superagent";


export const find = () => (
    Request.get(`/api/subtractions${window.location.search}`)
);

export const list = ({ page }) => (
    Request.get(`/api/subtractions?page=${page}`)
);

export const filter = ({ term }) => (
    Request.get(`/api/subtractions?find=${term}`)
);

export const listIds = () => (
    Request.get("/api/subtractions")
        .query({ids: true})
);

export const get = ({ subtractionId }) => (
    Request.get(`/api/subtractions/${subtractionId}`)
);

export const create = ({ subtractionId, fileId, nickname }) => (
    Request.post("/api/subtractions")
        .send({
            subtraction_id: subtractionId,
            file_id: fileId,
            nickname
        })
);

export const update = ({ subtractionId, nickname }) => (
    Request.patch(`/api/subtractions/${subtractionId}`)
        .send({ nickname })
);

export const remove = ({ subtractionId }) => (
    Request.delete(`/api/subtractions/${subtractionId}`)
);

Add page listing and filter requests
Add page listing and filter requests

