feat: login by command by web
This commit is contained in:
55
src/query/services/index.ts
Normal file
55
src/query/services/index.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { query } from '@/module/query.ts';
|
||||
|
||||
type OperateAction = 'start' | 'stop' | 'restart' | 'reload' | 'delete' | 'update' | 'install' | 'uninstall';
|
||||
export const queryServiceOperate = async (appKey: string, action: OperateAction) => {
|
||||
if (['start', 'stop', 'restart'].indexOf(action) === -1) {
|
||||
throw new Error('Invalid action');
|
||||
}
|
||||
return await query.post({
|
||||
path: 'local-apps',
|
||||
key: 'operate',
|
||||
appKey: appKey,
|
||||
action: action,
|
||||
});
|
||||
};
|
||||
|
||||
export const queryServiceList = async () => {
|
||||
return await query.post({
|
||||
path: 'local-apps',
|
||||
key: 'list',
|
||||
});
|
||||
};
|
||||
|
||||
export const queryServiceUpdate = async (appKey: string, data: any) => {
|
||||
return await query.post({
|
||||
path: 'local-apps',
|
||||
key: 'update',
|
||||
appkey: appKey,
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
|
||||
export const queryServiceDownload = async (id: string, token: string, installDeps: boolean = true) => {
|
||||
return await query.post({
|
||||
path: 'local-apps',
|
||||
key: 'download',
|
||||
id: id,
|
||||
token: token,
|
||||
installDeps: installDeps,
|
||||
});
|
||||
};
|
||||
|
||||
export const queryServiceDetect = async () => {
|
||||
return await query.get({
|
||||
path: 'local-apps',
|
||||
key: 'detect',
|
||||
});
|
||||
};
|
||||
|
||||
export const queryServiceDelect = async (appKey: string) => {
|
||||
return await query.get({
|
||||
path: 'local-apps',
|
||||
key: 'delete',
|
||||
appKey: appKey,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user