feat: ui to manaul trigger cron jobs

This commit is contained in:
Simon Ding
2024-09-07 13:18:12 +08:00
parent 5923fc73e1
commit bf608f933d
3 changed files with 73 additions and 5 deletions

View File

@@ -46,6 +46,8 @@ class APIs {
static final tmdbImgBaseUrl = "$_baseUrl/api/v1/posters";
static final cronJobUrl = "$_baseUrl/api/v1/setting/cron/trigger";
static const tmdbApiKey = "tmdb_api_key";
static const downloadDirKey = "download_dir";
@@ -100,4 +102,14 @@ class APIs {
context.go('/login');
}
}
static Future<void> triggerCronJob(String name) async {
var resp = await getDio().post(APIs.cronJobUrl, data: {"job_name": name});
var sp = ServerResponse.fromJson(resp.data);
if (sp.code != 0) {
throw sp.message;
}
}
}