Remove warnings
This commit is contained in:
parent
37a6d8bc21
commit
718195b2c9
|
@ -146,7 +146,7 @@ module.exports = {
|
|||
],
|
||||
// Disallows require statements except in import statements.
|
||||
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
|
||||
'@typescript-eslint/no-var-requires': 'error',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
|
||||
//
|
||||
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
|
||||
|
|
|
@ -33,8 +33,7 @@ namespace SampleConsumeFunc
|
|||
|
||||
var bearerToken = await _tokenValidationService
|
||||
.ValidateAuthorizationHeaderAsync(req);
|
||||
_logger.LogInformation("Bootstrap token: " + bearerToken); // not nessesary
|
||||
|
||||
|
||||
string siteUrl = req.Query["URL"];
|
||||
string siteDescreption = req.Query["Descreption"];
|
||||
|
||||
|
@ -53,8 +52,8 @@ namespace SampleConsumeFunc
|
|||
//string siteUrl = body.URL;
|
||||
//string siteDescreption = body.Descreption;
|
||||
|
||||
bool siteDescreptionUpdated = await _graphClientService.UpdateSiteDescreption(bearerToken, siteUrl, siteDescreption);
|
||||
return new OkObjectResult("Welcome to Azure Functions!");
|
||||
bool siteDescreptionUpdated = await _graphClientService.UpdateSiteDescreption(bearerToken, siteUrl, siteDescreption);
|
||||
return siteDescreptionUpdated ? new OkObjectResult("") : new BadRequestResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { ServiceKey, ServiceScope } from "@microsoft/sp-core-library";
|
||||
import { AadHttpClientFactory, AadHttpClient, HttpClientResponse } from "@microsoft/sp-http";
|
||||
const config: any = require('./azFunct.json')
|
||||
|
||||
const config = require('./azFunct.json');
|
||||
|
||||
export default class FunctionService {
|
||||
private aadHttpClientFactory: AadHttpClientFactory;
|
||||
|
@ -15,13 +16,13 @@ export default class FunctionService {
|
|||
});
|
||||
}
|
||||
|
||||
public async setNewSiteDescreption(siteUrl: string, siteDescreption: string): Promise<any[]> {
|
||||
public async setNewSiteDescreption(siteUrl: string, siteDescreption: string): Promise<boolean> {
|
||||
this.client = await this.aadHttpClientFactory.getClient(`${config.appIdUri}`);
|
||||
const requestUrl = `${config.hostUrl}/api/SiteFunction?URL=${siteUrl}&Descreption=${siteDescreption}`;
|
||||
return this.client
|
||||
.get(requestUrl, AadHttpClient.configurations.v1)
|
||||
.then((response: HttpClientResponse) => {
|
||||
return response.json();
|
||||
return response.ok;
|
||||
});
|
||||
|
||||
// POST alternative
|
||||
|
|
|
@ -18,8 +18,7 @@ export const SampleSiteFunction: React.FC<ISampleSiteFunctionProps> = (props) =>
|
|||
setDescription(value);
|
||||
};
|
||||
|
||||
const assignPermissions = async () => {
|
||||
console.log('Action');
|
||||
const assignPermissions = async (): Promise<void> => {
|
||||
const graphService = new FunctionService(props.serviceScope);
|
||||
|
||||
const resp = await graphService.setNewSiteDescreption(url, description);
|
||||
|
@ -30,12 +29,7 @@ export const SampleSiteFunction: React.FC<ISampleSiteFunctionProps> = (props) =>
|
|||
<section className={`${styles.sampleSiteFunction} ${props.hasTeamsContext ? styles.teams : ''}`}>
|
||||
<div className={styles.field}>
|
||||
<h2>{strings.HeaderLabel}</h2>
|
||||
</div>
|
||||
{/* <div>
|
||||
{
|
||||
props.isAdminMode?<div className={styles.field}><SelectSite serviceScope={props.serviceScope} siteSelectedCallback={retrieveSiteID} /></div>:<div className={styles.field}><h3>Current site is used</h3></div>
|
||||
}
|
||||
</div> */}
|
||||
</div>
|
||||
<div className={styles.field}>
|
||||
<TextField
|
||||
label={strings.URLLabel}
|
||||
|
|
Loading…
Reference in New Issue