bazarr/frontend/src/apis/utils.ts

29 lines
551 B
TypeScript
Raw Normal View History

import apis from ".";
2021-03-25 14:22:43 +00:00
type UrlTestResponse =
| {
status: true;
version: string;
}
| {
status: false;
error: string;
};
class RequestUtils {
urlTest(
protocol: string,
url: string,
params?: any
): Promise<UrlTestResponse> {
return new Promise<UrlTestResponse>((resolve, reject) => {
apis.axios
.get(`../test/${protocol}/${url}api/system/status`, { params })
2021-03-25 14:22:43 +00:00
.then((result) => resolve(result.data))
.catch(reject);
});
}
}
export default new RequestUtils();