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); } }