
import { $get, $post } from '@/utils'

export const VIDEO_GOODS = (id = '') => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/discover/video/goods', { id }, { isLoading: true });
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const VIDEO_COLLECTS = (id = '') => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/discover/video/collects', { id }, { isLoading: true });
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const DISCOVER_VIDEO_COMMENTS = (params) => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/discover/video/comments', params);
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const DISCOVER_VIDEO_SUBCOMMENTS = (params) => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/discover/video/subcomments', params);
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const DISCOVER_FOLLOW = (userid = "") => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/discover/follow', { userid });
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

