File size: 643 Bytes
f0953a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { injectable } from "inversify";
import { createAxiosInstance } from "../utils/axiosInstance";
import { AxiosInstance } from "axios";
import sponsors from "../sponsors/sponsors.json";

@injectable()
export class SponsorsService {
  private axiosInstance: AxiosInstance;

  constructor() {
    this.axiosInstance = createAxiosInstance("http://oss.jiangmuxin.cn/cloudsaver/");
  }
  async getSponsors() {
    try {
      const response = await this.axiosInstance.get("sponsors.json");
      return {
        data: response.data.sponsors,
      };
    } catch (error) {
      return {
        data: sponsors.sponsors,
      };
    }
  }
}