/* eslint-disable @typescript-eslint/no-explicit-any */
"use serve"
import axiosInstance from "@/lib/constant";
import { VideoInput, UpdateVideoInput } from "./type";
import { AxiosResponse } from "axios";

export const getVideos = () => {
   return axiosInstance.get(`video/all`);
}


export const geOneVideo = (postId: number) => {
   return axiosInstance.get(`video/view?v=${postId}`);
}

export const createVideo = async (body: VideoInput): Promise<AxiosResponse<VideoInput, any>> => {
   return await axiosInstance.post<VideoInput>('/video/add', body);
};


export const updateVideo = async (body: UpdateVideoInput): Promise<AxiosResponse<UpdateVideoInput, any>> => {
   return await axiosInstance.post<UpdateVideoInput>('/video/update', body);
};


