index.ts 439 B

1234567891011121314151617181920212223
  1. import { WEBUI_BASE_URL } from '$lib/constants';
  2. export const getBackendConfig = async () => {
  3. let error = null;
  4. const res = await fetch(`${WEBUI_BASE_URL}/api/config`, {
  5. method: 'GET',
  6. headers: {
  7. 'Content-Type': 'application/json'
  8. }
  9. })
  10. .then(async (res) => {
  11. if (!res.ok) throw await res.json();
  12. return res.json();
  13. })
  14. .catch((err) => {
  15. console.log(err);
  16. error = err;
  17. return null;
  18. });
  19. return res;
  20. };