From b6dff7d76e148cb613721a41ac53d3d4cda929e7 Mon Sep 17 00:00:00 2001 From: Vanessa Scherma Date: Sun, 27 Oct 2024 13:03:33 +0100 Subject: [PATCH] Fix codeclimate issue (gitlabDigitalTwin) --- client/src/preview/util/digitalTwinUtils.ts | 8 +++----- client/src/preview/util/gitlabDigitalTwin.ts | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/client/src/preview/util/digitalTwinUtils.ts b/client/src/preview/util/digitalTwinUtils.ts index 02733016b..4d1fff9fb 100644 --- a/client/src/preview/util/digitalTwinUtils.ts +++ b/client/src/preview/util/digitalTwinUtils.ts @@ -1,5 +1,4 @@ import { FileState } from "preview/store/file.slice"; -import GitlabInstance from "./gitlab"; import DigitalTwin from "./gitlabDigitalTwin"; export function isValidInstance(digitalTwin: DigitalTwin): boolean { @@ -36,14 +35,13 @@ export function getCommitMessage(file: FileState): string { } export async function createFile( - gitlabInstance: GitlabInstance, - projectId: number, + digitalTwin: DigitalTwin, file: FileState, filePath: string, commitMessage: string ): Promise { - await gitlabInstance.api.RepositoryFiles.create( - projectId, + await digitalTwin.gitlabInstance.api.RepositoryFiles.create( + digitalTwin.gitlabInstance.projectId!, `${filePath}/${file.name}`, 'main', file.content, diff --git a/client/src/preview/util/gitlabDigitalTwin.ts b/client/src/preview/util/gitlabDigitalTwin.ts index 4c52b2f48..1cf94dead 100644 --- a/client/src/preview/util/gitlabDigitalTwin.ts +++ b/client/src/preview/util/gitlabDigitalTwin.ts @@ -270,7 +270,7 @@ class DigitalTwin { const filePath = getFilePath(file, mainFolderPath, lifecycleFolderPath); const commitMessage = getCommitMessage(file); - await createFile(this.gitlabInstance, this.gitlabInstance.projectId, file, filePath, commitMessage); + await createFile(this, file, filePath, commitMessage); } }