Updated react-teams-lead-dashboard sample
This commit is contained in:
parent
347ed56030
commit
f4cf63665a
|
@ -2,9 +2,10 @@ import { HttpClient, MSGraphClient } from "@microsoft/sp-http";
|
||||||
|
|
||||||
export default class SettingsService {
|
export default class SettingsService {
|
||||||
/**
|
/**
|
||||||
* Get the application settings from drive
|
* Get the application settings from OneDrive
|
||||||
* @param graphClient Graph client to be used for the request
|
* @param graphClient Graph client to be used for the request
|
||||||
* @param httpClient Http client to be used for the request
|
* @param httpClient Http client to be used for the request
|
||||||
|
* @param settingsFilename Name of the file to read the settings from
|
||||||
* @returns Object representing the JSON settings file
|
* @returns Object representing the JSON settings file
|
||||||
*/
|
*/
|
||||||
public static async getSettings(graphClient: MSGraphClient, httpClient: HttpClient, settingsFilename: string): Promise<any> {
|
public static async getSettings(graphClient: MSGraphClient, httpClient: HttpClient, settingsFilename: string): Promise<any> {
|
||||||
|
@ -30,11 +31,12 @@ export default class SettingsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the specified settings to drive
|
* Save the specified settings to OneDrive
|
||||||
* @param graphClient Graph client to be used for the request
|
* @param graphClient Graph client to be used for the request
|
||||||
* @param settings Object representing the settings to be saved on the JSON settings file
|
* @param settings Object representing the settings to be saved on the JSON settings file
|
||||||
|
* @param settingsFilename Name of the file to store the settings on
|
||||||
*/
|
*/
|
||||||
public static async saveSiteUrl(graphClient: MSGraphClient, settings: any, settingsFilename: string) {
|
public static async saveSettings(graphClient: MSGraphClient, settings: any, settingsFilename: string) {
|
||||||
// Save the settings in the application dedicated folder
|
// Save the settings in the application dedicated folder
|
||||||
await graphClient
|
await graphClient
|
||||||
.api(`/me/drive/special/approot:/${settingsFilename}:/content`)
|
.api(`/me/drive/special/approot:/${settingsFilename}:/content`)
|
||||||
|
|
|
@ -136,7 +136,7 @@ export default class LeadAssistDashboard extends React.Component<ILeadAssistDash
|
||||||
<TextField value={this.props.siteUrl} onChange={this.changeSiteUrlHandler} />
|
<TextField value={this.props.siteUrl} onChange={this.changeSiteUrlHandler} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.padding5}>
|
<div className={styles.padding5}>
|
||||||
<PrimaryButton text={strings.SaveConfiguration} onClick={() => { SettingsService.saveSiteUrl(this.props.graphClient, { siteUrl: this.state.siteUrl }, 'lead_dashboard_settings.json'); }} />
|
<PrimaryButton text={strings.SaveConfiguration} onClick={() => { SettingsService.saveSettings(this.props.graphClient, { siteUrl: this.state.siteUrl }, 'lead_dashboard_settings.json'); }} />
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue