From 81c1c69cdc9ed0b381c60fe4fd2e4668abe00625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <git@minelli.swiss> Date: Tue, 25 Mar 2025 14:25:28 +0100 Subject: [PATCH] DojoBackendHelper => getApiUrl: Add userId in path --- helpers/Dojo/DojoBackendHelper.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/Dojo/DojoBackendHelper.ts b/helpers/Dojo/DojoBackendHelper.ts index bde3522..61043ce 100644 --- a/helpers/Dojo/DojoBackendHelper.ts +++ b/helpers/Dojo/DojoBackendHelper.ts @@ -3,10 +3,14 @@ import ClientsSharedConfig from '../../config/ClientsSharedConfig'; class DojoBackendHelper { - public getApiUrl(route: ApiRoute, options?: Partial<{ assignmentNameOrUrl: string, exerciseIdOrUrl: string, gitlabProjectId: string, tagName: string }>): string { + public getApiUrl(route: ApiRoute, options?: Partial<{ userId: number, assignmentNameOrUrl: string, exerciseIdOrUrl: string, gitlabProjectId: string, tagName: string }>): string { let url = `${ ClientsSharedConfig.apiURL }${ route }`; if ( options ) { + if ( options.userId ) { + url = url.replace('{{userId}}', encodeURIComponent(options.userId.toString())); + } + if ( options.assignmentNameOrUrl ) { url = url.replace('{{assignmentNameOrUrl}}', encodeURIComponent(options.assignmentNameOrUrl)); } -- GitLab