2021-04-21 14:29:25 +00:00
|
|
|
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) => {
|
2021-04-21 14:29:25 +00:00
|
|
|
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();
|