refactor for query params

This commit is contained in:
nquidox 2025-09-24 21:30:31 +03:00
parent 8b747f0a1e
commit f45ae05380

View file

@ -121,7 +121,11 @@ async function request(url, options = {}, isRetry = false) {
}
export const apiClient = {
get: (url) => request(url, { method: 'GET' }),
get: (url, params = {}) => {
const queryString = new URLSearchParams(params).toString();
const fullUrl = queryString ? `${url}?${queryString}` : url;
return request(fullUrl, { method: 'GET' });
},
post: (url, data) => request(url, {
method: 'POST',
body: JSON.stringify(data),