
import Taro from '@tarojs/taro'

export function getLocation() {
  return new Promise((resolve, reject) => {
    Taro.authorize({
      scope: 'scope.userLocation',
      success: () => {
        Taro.getLocation({
          type: 'wgs84',
          success: (res) => {
            resolve(res)
          },
          fail: (err) => {
            console.error(err)
            reject(err)
          }
        })
      },
      fail: (err) => {
        console.error(err)
        reject(err)
      }
    })
  })
}
