import { useAjax } from '@/Hook/useAjax'
import { getAdAccountApi, getAllUserAccountApi } from '@/services/launchAdq/adAuthorize'
import { getGroupListApi } from '@/services/launchAdq/subgroup'


export default function useAdAuthorize() {

    const getAdAccount = useAjax(() => getAdAccountApi(), { formatResult: true })
    const getAllUserAccount = useAjax(() => getAllUserAccountApi(), { formatResult: true })

    /** 所有分组列表 */
    const getGroupList = useAjax(() => getGroupListApi())


    /** 初始话 */
    const groupListInit = () => {
        getGroupList.run()
    }

    const groupRefresh = () => {
        getGroupList.refresh()
    }

    return {
        getAdAccount,
        getAllUserAccount,
        getGroupList,
        groupListInit,
        groupRefresh
    }
}