index.ts 828 Bytes
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
import { WEBUI_BASE_URL } from '$lib/constants';
Timothy J. Baek's avatar
Timothy J. Baek committed
2
3

export const getBackendConfig = async () => {
4
5
	let error = null;

Timothy J. Baek's avatar
Timothy J. Baek committed
6
	const res = await fetch(`${WEBUI_BASE_URL}/api/config`, {
7
8
		method: 'GET',
		headers: {
Timothy J. Baek's avatar
Timothy J. Baek committed
9
			'Content-Type': 'application/json'
10
11
12
13
14
15
		}
	})
		.then(async (res) => {
			if (!res.ok) throw await res.json();
			return res.json();
		})
Timothy J. Baek's avatar
Timothy J. Baek committed
16
17
18
		.catch((err) => {
			console.log(err);
			error = err;
19
20
21
			return null;
		});

Timothy J. Baek's avatar
Timothy J. Baek committed
22
	return res;
23
};
Timothy J. Baek's avatar
Timothy J. Baek committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

export const getChangelog = async () => {
	let error = null;

	const res = await fetch(`${WEBUI_BASE_URL}/api/changelog`, {
		method: 'GET',
		headers: {
			'Content-Type': 'application/json'
		}
	})
		.then(async (res) => {
			if (!res.ok) throw await res.json();
			return res.json();
		})
		.catch((err) => {
			console.log(err);
			error = err;
			return null;
		});

	return res;
};