fix pnp sp init

This commit is contained in:
matteo 2023-01-30 13:13:53 +01:00
parent b02e49046e
commit 6c85b8403c
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@
"@microsoft/sp-property-pane": "1.15.2", "@microsoft/sp-property-pane": "1.15.2",
"@microsoft/sp-webpart-base": "1.15.2", "@microsoft/sp-webpart-base": "1.15.2",
"@pnp/logging": "^3.6.0", "@pnp/logging": "^3.6.0",
"@pnp/sp": "^3.6.0", "@pnp/sp": "^3.11.0",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"office-ui-fabric-react": "7.185.7", "office-ui-fabric-react": "7.185.7",
"react": "16.13.1", "react": "16.13.1",
@ -43,4 +43,4 @@
"gulp": "4.0.2", "gulp": "4.0.2",
"typescript": "4.5.5" "typescript": "4.5.5"
} }
} }

View File

@ -9,7 +9,7 @@ import "@pnp/sp/batching";
let _sp: SPFI = null; let _sp: SPFI = null;
export const getSP = (context?: WebPartContext): SPFI => { export const getSP = (context?: WebPartContext): SPFI => {
if (_sp === null && context !== null) { if (context != null) {
_sp = spfi().using(SPFx(context)).using(PnPLogging(LogLevel.Warning)); _sp = spfi().using(SPFx(context)).using(PnPLogging(LogLevel.Warning));
} }
return _sp; return _sp;