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

DojoBackendHelper => getApiUrl: Add userId in path

parent dd00f13b
No related branches found
No related tags found
No related merge requests found
...@@ -3,10 +3,14 @@ import ClientsSharedConfig from '../../config/ClientsSharedConfig'; ...@@ -3,10 +3,14 @@ import ClientsSharedConfig from '../../config/ClientsSharedConfig';
class DojoBackendHelper { 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 }`; let url = `${ ClientsSharedConfig.apiURL }${ route }`;
if ( options ) { if ( options ) {
if ( options.userId ) {
url = url.replace('{{userId}}', encodeURIComponent(options.userId.toString()));
}
if ( options.assignmentNameOrUrl ) { if ( options.assignmentNameOrUrl ) {
url = url.replace('{{assignmentNameOrUrl}}', encodeURIComponent(options.assignmentNameOrUrl)); url = url.replace('{{assignmentNameOrUrl}}', encodeURIComponent(options.assignmentNameOrUrl));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment