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

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


export const geOneShort = (postId: number) => {
   return axiosInstance.get(`short/view?p=${postId}`);
}

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


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


