import { defineStore } from "pinia";

export const useLocationStore = defineStore('location', () => {

  const locationPlugin = uni.requireNativePlugin('Location')

  const getLocationInfo = () => {
    return new Promise(async (resolve, reject) => {
      locationPlugin.getLocationInfo((res) => {
        if (res.success) {
          resolve(res)
        } else {
          reject(res.msg)
        }
      })
    })
  }

  return { getLocationInfo }
})