1
0
mirror of https://github.com/franjsco/tick3t synced 2024-12-27 09:53:37 +01:00

improvement: handle status

This commit is contained in:
Francesco Esposito 2019-08-03 16:46:02 +02:00
parent 180eea3a8f
commit a552c67602

View File

@ -12,7 +12,13 @@ export const getTickets = (page = 1, status = '') => {
headers: header
};
return fetch(`${config.baseURL}tickets?page=${page}&status=${status}`, options)
let url = `${config.baseURL}tickets?page=${page}`;
if (status) {
url += `&status=${status}`;
}
return fetch(url, options)
.then(res => {
if (res.ok) {
return res.json();