37 lines
612 B
TypeScript
37 lines
612 B
TypeScript
|
import {getAxiosInstance} from "@/utils/axios";
|
||
|
|
||
|
export const http = getAxiosInstance({
|
||
|
timeout: 60 * 1000
|
||
|
})
|
||
|
|
||
|
export default http;
|
||
|
|
||
|
export interface ReadFileParams {
|
||
|
chunkSize?: number
|
||
|
offset?: number,
|
||
|
path: string
|
||
|
}
|
||
|
|
||
|
export class Api {
|
||
|
server:string
|
||
|
constructor(server:string) {
|
||
|
this.server = server
|
||
|
}
|
||
|
|
||
|
readFile(params: ReadFileParams){
|
||
|
return http.get(`${this.server}/s/file/`,{
|
||
|
params: params
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let api = new Api("")
|
||
|
|
||
|
export function initApi(server:string){
|
||
|
api = new Api(server)
|
||
|
}
|
||
|
|
||
|
export function useApi(){
|
||
|
return api
|
||
|
}
|