From 59ddd5cf39c14af23d597fd0b77bd2bba99d3348 Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Tue, 27 Jun 2023 17:46:56 +0200 Subject: [PATCH] update_branch_target to VirtualBranchesStore --- .../projects_new/[projectId]/+page.svelte | 2 +- .../projects_new/[projectId]/Tray.svelte | 25 +++---------------- .../projects_new/[projectId]/vbranches.ts | 13 ++++++++++ 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/routes/projects_new/[projectId]/+page.svelte b/src/routes/projects_new/[projectId]/+page.svelte index f3686a524..0b6a415ab 100644 --- a/src/routes/projects_new/[projectId]/+page.svelte +++ b/src/routes/projects_new/[projectId]/+page.svelte @@ -25,7 +25,7 @@ {#if target}
- +
{:else} diff --git a/src/routes/projects_new/[projectId]/Tray.svelte b/src/routes/projects_new/[projectId]/Tray.svelte index 67a5a7422..9a9421b64 100644 --- a/src/routes/projects_new/[projectId]/Tray.svelte +++ b/src/routes/projects_new/[projectId]/Tray.svelte @@ -1,32 +1,13 @@
0}
behind {target.behind}
- +
{:else}
diff --git a/src/routes/projects_new/[projectId]/vbranches.ts b/src/routes/projects_new/[projectId]/vbranches.ts index 7552c013d..8d30e456d 100644 --- a/src/routes/projects_new/[projectId]/vbranches.ts +++ b/src/routes/projects_new/[projectId]/vbranches.ts @@ -14,6 +14,7 @@ export interface VirtualBranchStore { setTarget: (branch: string) => Promise; createBranch: (name: string, path: string) => Promise; commitBranch: (branch: string, message: string) => Promise; + updateBranchTarget: () => Promise; } export function getStore(projectId: string): VirtualBranchStore { @@ -53,6 +54,18 @@ export function getStore(projectId: string): VirtualBranchStore { console.log(err); error('Failed to commit files.'); }); + }, + updateBranchTarget() { + return invoke('update_branch_target', { projectId: projectId }) + .then((res) => { + // TODO + // We need to refetch target data here + console.log(res); + }) + .catch((err) => { + console.log(err); + error('Unable to update target!'); + }); } }; cache.set(projectId, store);