Skip to content
Snippets Groups Projects
Commit 4011aa14 authored by michael.minelli's avatar michael.minelli
Browse files

Fix bug on get api url function

parent 42561140
Branches
No related tags found
No related merge requests found
......@@ -4,19 +4,19 @@ import ClientsSharedConfig from '../../config/ClientsSharedConfig.js';
class DojoBackendHelper {
public getApiUrl(route: ApiRoute, options?: Partial<{ assignmentNameOrUrl: string, exerciseIdOrUrl: string, gitlabProjectId: string }>): string {
const url = `${ ClientsSharedConfig.apiURL }${ route }`;
let url = `${ ClientsSharedConfig.apiURL }${ route }`;
if ( options ) {
if ( options.assignmentNameOrUrl ) {
return url.replace('{{assignmentNameOrUrl}}', encodeURIComponent(options.assignmentNameOrUrl));
url = url.replace('{{assignmentNameOrUrl}}', encodeURIComponent(options.assignmentNameOrUrl));
}
if ( options.exerciseIdOrUrl ) {
return url.replace('{{exerciseIdOrUrl}}', encodeURIComponent(options.exerciseIdOrUrl));
url = url.replace('{{exerciseIdOrUrl}}', encodeURIComponent(options.exerciseIdOrUrl));
}
if ( options.gitlabProjectId ) {
return url.replace('{{gitlabProjectId}}', encodeURIComponent(options.gitlabProjectId));
url = url.replace('{{gitlabProjectId}}', encodeURIComponent(options.gitlabProjectId));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment