| 
									
										
										
										
											2024-02-22 10:12:01 +08:00
										 |  |  | import { WEBUI_BASE_URL } from '$lib/constants'; | 
					
						
							| 
									
										
										
										
											2023-12-27 03:32:22 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export const getBackendConfig = async () => { | 
					
						
							| 
									
										
										
										
											2023-12-26 19:28:30 +08:00
										 |  |  | 	let error = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 10:12:01 +08:00
										 |  |  | 	const res = await fetch(`${WEBUI_BASE_URL}/api/config`, { | 
					
						
							| 
									
										
										
										
											2023-12-26 19:28:30 +08:00
										 |  |  | 		method: 'GET', | 
					
						
							|  |  |  | 		headers: { | 
					
						
							| 
									
										
										
										
											2023-12-27 03:32:22 +08:00
										 |  |  | 			'Content-Type': 'application/json' | 
					
						
							| 
									
										
										
										
											2023-12-26 19:28:30 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	}) | 
					
						
							|  |  |  | 		.then(async (res) => { | 
					
						
							|  |  |  | 			if (!res.ok) throw await res.json(); | 
					
						
							|  |  |  | 			return res.json(); | 
					
						
							|  |  |  | 		}) | 
					
						
							| 
									
										
										
										
											2023-12-27 03:32:22 +08:00
										 |  |  | 		.catch((err) => { | 
					
						
							|  |  |  | 			console.log(err); | 
					
						
							|  |  |  | 			error = err; | 
					
						
							| 
									
										
										
										
											2023-12-26 19:28:30 +08:00
										 |  |  | 			return null; | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 03:32:22 +08:00
										 |  |  | 	return res; | 
					
						
							| 
									
										
										
										
											2023-12-26 19:28:30 +08:00
										 |  |  | }; |