softwareInfo.ts 637 B

1234567891011121314151617181920212223242526272829
  1. import axiosInstance from './interceptor';
  2. export interface SoftwareInfo {
  3. language: string[];
  4. product: string;
  5. server: Record<
  6. string,
  7. {
  8. build: string;
  9. desc: string;
  10. version: string;
  11. }
  12. >;
  13. }
  14. export interface SoftwareInfoResponse {
  15. code: string;
  16. description: string;
  17. solution: string;
  18. data: SoftwareInfo;
  19. }
  20. export async function fetchSoftwareInfo(): Promise<SoftwareInfo> {
  21. const response = await axiosInstance.get('/pub/software_info');
  22. if (response.data && response.data.code === '0x000000') {
  23. return response.data.data;
  24. }
  25. throw new Error('Failed to fetch software info');
  26. }