| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  | import { useAsyncKey } from "../use-utils"; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | import type { AppInfo } from "~/lib/api/types/admin"; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function useAppInfo(): Ref<AppInfo | null> { | 
					
						
							| 
									
										
										
										
											2022-03-15 19:31:45 -08:00
										 |  |  |   const appInfo = ref<null | AppInfo>(null); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   const i18n = useI18n(); | 
					
						
							|  |  |  |   const { $axios } = useNuxtApp(); | 
					
						
							|  |  |  |   $axios.defaults.headers.common["Accept-Language"] = i18n.locale.value; | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   useAsyncData(useAsyncKey(), async () => { | 
					
						
							| 
									
										
										
										
											2022-03-22 20:41:54 -08:00
										 |  |  |     const data = await $axios.get<AppInfo>("/api/app/about"); | 
					
						
							|  |  |  |     appInfo.value = data.data; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2022-03-15 19:31:45 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return appInfo; | 
					
						
							| 
									
										
										
										
											2022-03-15 17:34:53 -08:00
										 |  |  | } |