provider.ts 546 Bytes
import axios from 'axios';

type LoginData = { access_token: string; refresh_token: string; nick_name: string };

export default class useProviderApi {
  static async area() {
    return axios.get('/provider/area');
  }

  static sms(type: string, phone: string, area?: string) {
    return axios.post('/provider/sms', { type, phone, area, platform: 'admin', scope: 1 });
  }

  static async login(type: 'phone' | 'email', data: object) {
    return axios.post<LoginData>('/provider/login', { platform: 'admin', scope: 1, type, ...data });
  }
}