Projekt

Obecné

Profil

Stáhnout (1.19 KB) Statistiky
| Větev: | Tag: | Revize:
1
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

    
17

    
18

    
19
/*
20

    
21

    
22
// inventories
23
@activeTab: index of selected inventory: result: Inventories (starting from 0)
24

    
25
// pagination
26
@page: page number (starting from 1) -> current page is returned as result
27
@items: page size
28
@cursor: (page - 1) * pageSize ? 
29

    
30

    
31
// location
32
@room: id of room in which we are looking for items
33
@place: id of place inside a room in which we are looking for items
34
*/
35
export const getPlanItemsRequest = async (params: { cursor: number, room: number, items?: number, place?: number, inventory?: string}) => {
36

    
37

    
38
    let url = `search_v2?tabbed=true&room=${params.room}&cursor=${params.cursor}`
39

    
40
    if(params.place){
41
        url += `&place=${params.place}`
42
    }
43

    
44
    if(params.inventory){
45
        url += `&inventory=${params.inventory}`
46
    }
47
    else{
48
        url += `&activeTab=0`
49
    }
50

    
51
    if(params.items){
52
        url += `&items=${params.items}`
53
    }
54

    
55
    console.log(url)
56

    
57
    return await axiosInstance.get(
58
        url
59
    )
60
}
61

    
(7-7/9)