35 lines
698 B
TypeScript
35 lines
698 B
TypeScript
import axios, { type AxiosInstance } from "axios";
|
|
|
|
class TypingService {
|
|
axios: AxiosInstance | null = null;
|
|
|
|
constructor() {
|
|
this.axios = axios.create({
|
|
baseURL: import.meta.env.VITE_API_TYPE_URL,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
}
|
|
|
|
async send(
|
|
message: string
|
|
): Promise<{ status: boolean; typed: string } | null> {
|
|
if (!this.axios) return null;
|
|
|
|
// const { data } = await this.axios({
|
|
// method: "POST",
|
|
// url: "type",
|
|
// data: {
|
|
// message,
|
|
// },
|
|
// });
|
|
|
|
// return data;
|
|
|
|
return { status: true, typed: message };
|
|
}
|
|
}
|
|
|
|
export const typeingService = new TypingService();
|