fix: wire up prService template fns correctly

This commit is contained in:
ndom91 2024-09-10 19:29:24 +02:00
parent 8194283275
commit 09b02feb78
3 changed files with 6 additions and 3 deletions

View File

@ -91,7 +91,7 @@
const prTemplatePath = project.git_host.pullRequestTemplatePath;
if (prTemplatePath) {
pullRequestTemplateBody = await $gitHost.getPrTemplateContent(prTemplatePath);
pullRequestTemplateBody = await $prService?.getPrTemplateContent(prTemplatePath);
}
if (pullRequestTemplateBody) {

View File

@ -107,7 +107,7 @@ export class GitHubPrService implements GitHostPrService {
const availableTemplates: string[] | undefined = await invoke(
'available_pull_request_templates',
{ path: targetPath }
{ rootPath: targetPath }
);
return availableTemplates;

View File

@ -2,6 +2,7 @@
import { Project, ProjectService } from '$lib/backend/projects';
import SectionCard from '$lib/components/SectionCard.svelte';
import { getGitHost } from '$lib/gitHost/interface/gitHost';
import { createGitHostPrServiceStore } from '$lib/gitHost/interface/gitHostPrService';
import Select from '$lib/select/Select.svelte';
import SelectItem from '$lib/select/SelectItem.svelte';
import Section from '$lib/settings/Section.svelte';
@ -12,6 +13,8 @@
const projectService = getContext(ProjectService);
const project = getContext(Project);
const gitHost = getGitHost();
const prService = createGitHostPrServiceStore(undefined);
$effect(() => prService.set($gitHost?.prService()));
let useTemplate = $state(!!project.git_host?.pullRequestTemplatePath);
let selectedTemplate = $state(project.git_host?.pullRequestTemplatePath ?? '');
@ -19,7 +22,7 @@
$effect(() => {
if (!project.path) return;
$gitHost?.getAvailablePrTemplates(project.path).then((availableTemplates) => {
$prService?.getAvailablePrTemplates(project.path).then((availableTemplates) => {
if (availableTemplates) {
allAvailableTemplates = availableTemplates.map((availableTemplate) => {
return {