Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure updating function doesn't reset other params #188

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@

async function updateName() {
try {
await sdkForProject.functions.update(functionId, functionName, $func.execute);
await sdkForProject.functions.update(
functionId,
functionName,
$func.execute,
$func.events,
$func.schedule,
$func.timeout,
$func.enabled
);
invalidate(Dependencies.FUNCTION);
addNotification({
message: 'Name has been updated',
Expand All @@ -79,7 +87,15 @@

async function updatePermissions() {
try {
await sdkForProject.functions.update(functionId, $func.name, permissions);
await sdkForProject.functions.update(
functionId,
$func.name,
permissions,
$func.events,
$func.schedule,
$func.timeout,
$func.enabled
);
invalidate(Dependencies.FUNCTION);
addNotification({
message: 'Permissions have been updated',
Expand All @@ -100,7 +116,10 @@
functionId,
$func.name,
$func.execute,
Array.from($eventSet)
Array.from($eventSet),
$func.schedule,
$func.timeout,
$func.enabled
);
invalidate(Dependencies.FUNCTION);
addNotification({
Expand All @@ -124,7 +143,8 @@
$func.execute,
$func.events,
functionSchedule,
timeout
$func.timeout,
$func.enabled
);
invalidate(Dependencies.FUNCTION);

Expand All @@ -149,9 +169,11 @@
$func.execute,
$func.events,
$func.schedule,
timeout
timeout,
$func.enabled
);

invalidate(Dependencies.FUNCTION);
addNotification({
type: 'success',
message: 'Timeout has been updated'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { page } from '$app/stores';
import { derived, writable, type Writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';

export const func = derived(page, ($page) => $page.data.function);
export const func = derived(page, ($page) => $page.data.function as Models.Function);
export const execute: Writable<Models.Function> = writable();