summaryrefslogtreecommitdiff
path: root/frontend/src/api/routes/rooms.js
blob: f87d12986df84a7943c343588809073e01c4ff43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { sendRequest } from '../index'
import { deleteById, getById } from './util'

export function getRoom(roomId) {
    return getById('/rooms/{roomId}', { roomId })
}

export function updateRoom(room) {
    return sendRequest({
        path: '/rooms/{roomId}',
        method: 'PUT',
        parameters: {
            body: {
                room,
            },
            path: {
                roomId: room.id,
            },
            query: {},
        },
    })
}

export function deleteRoom(roomId) {
    return deleteById('/rooms/{roomId}', { roomId })
}

export function getTilesOfRoom(roomId) {
    return getById('/rooms/{roomId}/tiles', { roomId })
}

export function addTileToRoom(tile) {
    return sendRequest({
        path: '/rooms/{roomId}/tiles',
        method: 'POST',
        parameters: {
            body: {
                tile,
            },
            path: {
                roomId: tile.roomId,
            },
            query: {},
        },
    })
}