mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-03-22 12:52:19 +08:00
48 lines
839 B
TypeScript
48 lines
839 B
TypeScript
interface Success {
|
|
status: 'ok';
|
|
}
|
|
|
|
export const apiProgram = {
|
|
/**
|
|
* 重启
|
|
*/
|
|
async restart() {
|
|
const { data } = await axios.get<Success>('api/v1/restart');
|
|
return data.status === 'ok';
|
|
},
|
|
|
|
/**
|
|
* 启动
|
|
*/
|
|
async start() {
|
|
const { data } = await axios.get<Success>('api/v1/start');
|
|
return data.status === 'ok';
|
|
},
|
|
|
|
/**
|
|
* 停止
|
|
*/
|
|
async stop() {
|
|
const { data } = await axios.get<Success>('api/v1/stop');
|
|
return data.status === 'ok';
|
|
},
|
|
|
|
/**
|
|
* 状态
|
|
*/
|
|
async status() {
|
|
const { data } = await axios.get<{ status: 'running' | 'stop' }>(
|
|
'api/v1/status'
|
|
);
|
|
return data.status === 'running';
|
|
},
|
|
|
|
/**
|
|
* 终止
|
|
*/
|
|
async shutdown() {
|
|
const { data } = await axios.get<Success>('api/v1/shutdown');
|
|
return data.status === 'ok';
|
|
},
|
|
};
|