Skip to content

Instantly share code, notes, and snippets.

@ypcode
Created July 7, 2017 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypcode/d943851248b734403f0eda045f732aa5 to your computer and use it in GitHub Desktop.
Save ypcode/d943851248b734403f0eda045f732aa5 to your computer and use it in GitHub Desktop.
import { IHardwareRequest } from "../model/IHardwareRequest";
import { HttpClient, HttpClientConfiguration, IHttpClientOptions, HttpClientResponse } from "@microsoft/sp-http";
// Replace these constants by your own azure function URL
export const AzureFunctionUrl = "https://your-func.azurewebsites.net/api/AddHardwareRequest";
export const AzureFunctionSiteUrl = "https://your-func.azurewebsites.net";
export class HardwareRequestProxyService {
constructor(private httpClient: HttpClient) {
}
public submitRequest(request: IHardwareRequest): Promise<HttpClientResponse> {
return this.httpClient.post(AzureFunctionUrl, HttpClient.configurations.v1, {
credentials: "include",
mode: "cors",
body: JSON.stringify(request)
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment