mirror of https://github.com/franjsco/tick3t
feat(api): add new methods categories
This commit is contained in:
parent
a212b05494
commit
e7793fe063
|
@ -1,16 +1,47 @@
|
|||
import { config } from '../config';
|
||||
import { httpClient } from './httpClient';
|
||||
|
||||
export const getAllTicketStatus = () => {
|
||||
|
||||
const header = new Headers({
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: header
|
||||
};
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: header
|
||||
};
|
||||
|
||||
return httpClient(`${config.baseURL}categories?type=TicketStatus`, options)
|
||||
return fetch(`${config.baseURL}categories?type=TicketStatus`, options)
|
||||
.then(res => {
|
||||
if (res.ok) {
|
||||
return res.json();
|
||||
} else if (res.status === 404) {
|
||||
throw new Error('Categories not found.');
|
||||
} else {
|
||||
throw new Error('Ops,problem');
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export const getAllTicketType = () => {
|
||||
const header = new Headers({
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: header
|
||||
};
|
||||
|
||||
|
||||
return fetch(`${config.baseURL}categories?type=TicketType`, options)
|
||||
.then(res => {
|
||||
if (res.ok) {
|
||||
return res.json();
|
||||
} else if (res.status === 404) {
|
||||
throw new Error('Categories not found.');
|
||||
} else {
|
||||
throw new Error('Ops,problem');
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue