1 | import { InjectHeaders, RejectOnError, ResolveOnData } from "@pnp/queryable";
|
2 | import { Telemetry } from "./telemetry.js";
|
3 | export function DefaultInit() {
|
4 | return (instance) => {
|
5 | instance.on.pre(async (url, init, result) => {
|
6 | init.cache = "no-cache";
|
7 | init.credentials = "same-origin";
|
8 | return [url, init, result];
|
9 | });
|
10 | instance.using(Telemetry(), RejectOnError(), ResolveOnData());
|
11 | return instance;
|
12 | };
|
13 | }
|
14 | export function DefaultHeaders() {
|
15 | return (instance) => {
|
16 | instance
|
17 | .using(InjectHeaders({
|
18 | "Accept": "application/json",
|
19 | "Content-Type": "application/json;charset=utf-8",
|
20 | }));
|
21 | return instance;
|
22 | };
|
23 | }
|
24 |
|
\ | No newline at end of file |