1 | import { addProp, body } from "@pnp/queryable";
|
2 | import { _Web, Web } from "../webs/types.js";
|
3 | import { SiteUsers, SiteUser } from "./types.js";
|
4 | import { odataUrlFrom } from "../utils/odata-url-from.js";
|
5 | import { spPost } from "../operations.js";
|
6 | addProp(_Web, "siteUsers", SiteUsers);
|
7 | addProp(_Web, "currentUser", SiteUser);
|
8 | _Web.prototype.ensureUser = async function (logonName) {
|
9 | const data = await spPost(Web(this, "ensureuser"), body({ logonName }));
|
10 | return {
|
11 | data,
|
12 | user: SiteUser([this, odataUrlFrom(data)]),
|
13 | };
|
14 | };
|
15 | _Web.prototype.getUserById = function (id) {
|
16 | return SiteUser(this, `getUserById(${id})`);
|
17 | };
|
18 |
|
\ | No newline at end of file |