provider.ts 665 Bytes
import { AnyObject } from '@/types/global';
import axios from 'axios';

export default class useProviderApi {
  static sms(type: string, phone: string, area?: string) {
    return axios.post('/provider/sms', { type, phone, area, platform: 'user' });
  }

  static async area() {
    return axios.get('/provider/area');
  }

  static async config(params?: AnyObject) {
    return axios.get('/provider/configs', { params })
  }

  static async login(type: 'phone' | 'email', data: object) {
    return axios.post<{ access_token: string; refresh_token: string; nick_name: string }>('/provider/login', {
      platform: 'user',
      type,
      ...data,
    });
  }
}