-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature(402686):Api integration for edit and delete
- Loading branch information
1 parent
017c669
commit 2d9dd3d
Showing
7 changed files
with
113 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface WorkflowListPathsType { | ||
readonly updateWorkflowRules: string; | ||
readonly deleteWorkflowRules: string; | ||
} | ||
|
||
const apiPaths: WorkflowListPathsType = { | ||
updateWorkflowRules: `{baseUrl}/{workflowId}/rules/{ruleId}/update`, | ||
deleteWorkflowRules: `{baseUrl}/rules/{ruleId}/delete`, | ||
} | ||
|
||
export const WorkflowApiPaths: WorkflowListPathsType = apiPaths; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { WorkflowApiPaths } from '../api/workflowDesignerAPI'; | ||
import { ChatWorkflowRulesData2 } from '../models/appModel'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class WorkflowService { | ||
private baseUrl = 'https://localhost:44303/chatwidget-api/v1/workflow-designer'; | ||
|
||
constructor(private http: HttpClient) {} | ||
|
||
httpOptions = { | ||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }) | ||
}; | ||
|
||
updateDiagramData(workflowId :number , ruleId: number, body : ChatWorkflowRulesData2) : Promise<{ message: string }> { | ||
const url = WorkflowApiPaths.updateWorkflowRules | ||
.replace('{baseUrl}', this.baseUrl) | ||
.replace('{workflowId}', workflowId.toString()) | ||
.replace('{ruleId}', ruleId.toString()); | ||
|
||
return this.http.put<{ message: string }>(url, body, this.httpOptions).toPromise(); | ||
} | ||
|
||
deleteDiagramData(ruleId: number): Promise<{ message: string }> { | ||
const url = WorkflowApiPaths.updateWorkflowRules | ||
.replace('{baseUrl}', this.baseUrl) | ||
.replace('{ruleId}', ruleId.toString()); | ||
|
||
return this.http.put<{ message: string }>(url, this.httpOptions).toPromise(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { appConfig } from './app/app.config'; | ||
import { AppComponent } from './app/app.component'; | ||
import { provideHttpClient } from '@angular/common/http'; | ||
|
||
bootstrapApplication(AppComponent, appConfig) | ||
.catch((err) => console.error(err)); | ||
bootstrapApplication(AppComponent, { | ||
...appConfig, | ||
providers: [ | ||
provideHttpClient() // Add HttpClientModule to providers | ||
] | ||
}).catch((err) => console.error(err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters