Projekt

Obecné

Profil

Stáhnout (1.31 KB) Statistiky
| Větev: | Tag: | Revize:
1 f8083631 Fantič
import { axiosInstance } from "./api"
2
3
4
export const getPlanAllRequest = async () => {
5
    return await axiosInstance.get(
6
        `/plan/all`
7
    )
8
}
9
10
export const getPlanListRequest = async () => {
11
    return await axiosInstance.get(
12
        `/plan/list`
13
    )
14
}
15
16 aac857cf Fantič
export const getPlanFloorImageRequest = async (floorId: string) => {
17
    return await axiosInstance.get(`/downloads/${floorId}`);
18
}
19 160b7073 Fantič
20
/*
21
// inventories
22
@activeTab: index of selected inventory: result: Inventories (starting from 0)
23
24
// pagination
25
@page: page number (starting from 1) -> current page is returned as result
26
@items: page size
27
@cursor: (page - 1) * pageSize ? 
28
29
30
// location
31
@room: id of room in which we are looking for items
32
@place: id of place inside a room in which we are looking for items
33
*/
34 a6999074 Fantič
export const getPlanItemsRequest = async (params: { cursor: number, room: number, items?: number, place?: number, inventory?: string}) => {
35 160b7073 Fantič
36
37 a6999074 Fantič
    let url = `search_v2?tabbed=true&room=${params.room}&cursor=${params.cursor}`
38 160b7073 Fantič
39
    if(params.place){
40
        url += `&place=${params.place}`
41 f8083631 Fantič
    }
42
43 160b7073 Fantič
    if(params.inventory){
44
        url += `&inventory=${params.inventory}`
45
    }
46 a6999074 Fantič
    else{
47
        url += `&activeTab=0`
48
    }
49
50
    if(params.items){
51
        url += `&items=${params.items}`
52
    }
53 160b7073 Fantič
54
    console.log(url)
55
56 f8083631 Fantič
    return await axiosInstance.get(
57
        url
58
    )
59
}