Created
July 7, 2017 07:47
-
-
Save ypcode/d943851248b734403f0eda045f732aa5 to your computer and use it in GitHub Desktop.
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
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