post with params&body, routing
This commit is contained in:
parent
e03d5f7ed2
commit
1d4d32197c
|
@ -6,7 +6,7 @@ import { DynamicFormComponent } from '../form/dynamic-form.component';
|
|||
import { AuthGuard } from '../guards/auth.guard';
|
||||
|
||||
const projectsRoutes: Routes = [
|
||||
{ path: 'tabs/dmps', component: DmpComponent },
|
||||
//{ path: 'tabs/dmps', component: DmpComponent },
|
||||
{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] }
|
||||
];
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import { DynamicFormComponent } from '../form/dynamic-form.component';
|
|||
import { AuthGuard } from '../guards/auth.guard';
|
||||
|
||||
const projectsRoutes: Routes = [
|
||||
{ path: 'tabs/projects', component: ProjectsComponent }, // canActivate: [AuthGuard]
|
||||
// { path: 'tabs/projects', component: ProjectsComponent }, // canActivate: [AuthGuard]
|
||||
{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] }
|
||||
];
|
||||
|
||||
|
|
|
@ -52,6 +52,12 @@ export class RestBase {
|
|||
return this.http.post<any>(this.restPath + path, JSON.stringify(data), options);
|
||||
}
|
||||
|
||||
public postWithParams(path : string, data : any, params: HttpParams) {
|
||||
var options = this.createOptions();
|
||||
options.params = params;
|
||||
return this.http.post<any>(this.restPath + path, JSON.stringify(data), options);
|
||||
}
|
||||
|
||||
|
||||
private createOptions(){
|
||||
var token = this.tokenService.getToken();
|
||||
|
|
|
@ -105,10 +105,10 @@ export class ServerService {
|
|||
}
|
||||
|
||||
public createDmpForProject(data:any, projectid: string){
|
||||
return this.restBase.post("dmp/createforproject", data);
|
||||
// return this.restBase.post('dmp/createforproject', data, {
|
||||
// params: new HttpParams().set('projectid', projectid),
|
||||
// })
|
||||
//return this.restBase.post("dmp/createforproject", data);
|
||||
return this.restBase.postWithParams('dmp/createforproject', data,
|
||||
new HttpParams().set('projectid', projectid)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,13 @@ import { RouterModule, Routes } from '@angular/router';
|
|||
|
||||
import { TabComponent } from './tabs.component';
|
||||
import { AuthGuard } from '../guards/auth.guard';
|
||||
import { ProjectsComponent } from '../projects/projects.component';
|
||||
import { DmpComponent } from '../dmps/dmp.component';
|
||||
|
||||
const tabsRoutes: Routes = [
|
||||
{ path: 'tabs', component: TabComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'tabs/projects', component: ProjectsComponent }, // canActivate: [AuthGuard]
|
||||
{ path: 'tabs/dmps', component: DmpComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
Loading…
Reference in New Issue