import request from "../utils/request.js";

/**
 * restFul GET API
 * @param {string} url request address
 * @param {any} params query Params
 * @param {any} data other request header params
 * @return {Promise}
 */
export const getAction = ({url, params, ...data})=>{
    return request({
        url,
        method: 'get',
        params,
        ...data
    })
}

/**
 * restFul GET API
 * @param {string} url request address
 * @param {any} body  request body
 * @param {any} data other request header params
 * @return {Promise}
 */
export const postAction = ({url, body, ...data})=>{
    return request({
        url,
        method: 'get',
        data: body,
        ...data
    })
}


/**
 * get nav list
 */
export const getNavData = ()=>{
    return request({
        url: '/index/getNav',
        method:'get',
    })
}
/**
 * get nav list
 */
export const getNavInfoApi = (params)=>{
    return request({
        url: '/index/getNavInfo',
        method: 'get',
        params,
    })
}

/**
 *
 */
export const getHackathonApi = (data)=>{
    return request({
        url: '/hackathon/getHackathon',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const clickMediaApi = (data)=>{
    return request({
        url: '/media/clickMedia',
        method: 'post',
        data,
        headers: {
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const getMediaApi = (data)=>{
    return request({
        url: '/media/getMedia',
        method: 'post',
        data,
        headers: {
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const getPortfolioApi = (data)=>{
    return request({
        url: '/portfolio/getPortfolio',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const clickNewsApi = (data)=>{
    return request({
        url: '/news/clickNews',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}
export const getNewsApi = (data)=>{
    return request({
        url: '/news/getNews',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const subscribedApi = (data)=>{
    return request({
        url: '/newsletter/subscribed',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const getTeamApi = (data)=>{
    return request({
        url: '/team/getTeam',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}
export const getConfigApi = (data)=>{
    return request({
        url: '/index/getConfig',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const getPageApi = (data)=>{
    return request({
        url: '/page/getPage',
        method: 'post',
        data,
        headers:{
            "Content-Type": 'multipart/form-data'
        }
    })
}

export const clickHackathon = (data)=>{
    return request({
        url: '/hackathon/clickHackathon',
        method: 'post',
        data,
        headers: {
            "Content-Type": 'multipart/form-data'
        }
    })
}
export const clickPortfolio = (data)=>{
    return request({
        url: '/portfolio/clickPortfolio',
        method: 'post',
        data,
        headers: {
            "Content-Type": 'multipart/form-data'
        }
    })
}
