forked from amand33p/bug-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.ts
More file actions
47 lines (41 loc) · 940 Bytes
/
Copy pathnotes.ts
File metadata and controls
47 lines (41 loc) · 940 Bytes
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
47
import axios from 'axios';
import backendUrl from '../backendUrl';
import { setConfig } from './auth';
const baseUrl = `${backendUrl}/projects`;
const createNote = async (
projectId: string,
bugId: string,
noteBody: string
) => {
const response = await axios.post(
`${baseUrl}/${projectId}/bugs/${bugId}/notes`,
{ body: noteBody },
setConfig()
);
return response.data;
};
const editNote = async (
projectId: string,
noteId: number,
noteBody: string
) => {
const response = await axios.put(
`${baseUrl}/${projectId}/notes/${noteId}`,
{ body: noteBody },
setConfig()
);
return response.data;
};
const deleteNote = async (projectId: string, noteId: number) => {
const response = await axios.delete(
`${baseUrl}/${projectId}/notes/${noteId}`,
setConfig()
);
return response.data;
};
const noteService = {
createNote,
editNote,
deleteNote,
};
export default noteService;