mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #1697 from appwrite/validate-function-cron
Validate cron before updating function
This commit is contained in:
+5
@@ -11,6 +11,7 @@
|
||||
import { func } from '../store';
|
||||
import { isValueOfStringEnum } from '$lib/helpers/types';
|
||||
import { Runtime } from '@appwrite.io/console';
|
||||
import { parseExpression } from 'cron-parser';
|
||||
|
||||
const functionId = $page.params.function;
|
||||
let functionSchedule: string = null;
|
||||
@@ -24,6 +25,10 @@
|
||||
if (!isValueOfStringEnum(Runtime, $func.runtime)) {
|
||||
throw new Error(`Invalid runtime: ${$func.runtime}`);
|
||||
}
|
||||
|
||||
// an error is shown if invalid.
|
||||
parseExpression(functionSchedule);
|
||||
|
||||
await sdk.forProject.functions.update(
|
||||
functionId,
|
||||
$func.name,
|
||||
|
||||
Reference in New Issue
Block a user