Projekt

Obecné

Profil

« Předchozí | Další » 

Revize bb690a9a

Přidáno uživatelem Fantič před téměř 2 roky(ů)

re #10569: NotesView: Get Notes

Zobrazit rozdíly:

src/api/notesservice.ts
1
import { SortOptions } from "../types/general"
1 2
import { axiosInstance } from "./api"
2 3

  
3 4

  
4 5
export const getItemNotesRequest = async (itemId : string) => {
5 6
    return await axiosInstance.get(
6
        `/api/notes/?item_id[]=${itemId}`
7
        `/notes/?item_id[]=${itemId}`
7 8
    )
8 9
}
9 10

  
11
export const getAllNotesRequest = async (myComments : boolean, generalComments : boolean, sortOptions: { items: SortOptions, date: SortOptions }) => {
12
    let url = `/notes/?my_notes=${myComments}&general_notes=${generalComments}`;
13

  
14
    if(sortOptions.date != SortOptions.None){
15
        url += "&order_by=date&order_dir="+sortOptions.date;
16
    }
17
    if(sortOptions.items != SortOptions.None){
18
        url += "&order_by=items&order_dir="+sortOptions.items;
19
    }
20

  
21
    return await axiosInstance.get(
22
        url
23
    )
24
}
25

  
26

  
27

  

Také k dispozici: Unified diff