Skip to content

Commit 9f220e3

Browse files
committed
DOC-3251: Update mentions demos
1 parent 1e09b0a commit 9f220e3

File tree

3 files changed

+40
-10
lines changed
  • modules/ROOT/examples/live-demos

3 files changed

+40
-10
lines changed

modules/ROOT/examples/live-demos/comments-callback-with-mentions/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ const mentions_fetch = async (query, success) => {
5151
const searchPhrase = query.term.toLowerCase();
5252
await fetch(`${API_URL}?q=${encodeURIComponent(searchPhrase)}`)
5353
.then((response) => response.json())
54-
.then((users) => success(users.data))
54+
.then((users) => success(users.data.map((userInfo) => ({
55+
id: userInfo.id,
56+
name: userInfo.name,
57+
image: userInfo.avatar,
58+
description: userInfo.custom.role
59+
}))))
5560
.catch((error) => console.log(error));
5661
};
5762

@@ -80,14 +85,19 @@ const mentions_select = async (mention, success) => {
8085
await fetch(`${API_URL}/${id}`)
8186
.then((response) => response.json())
8287
.then((userInfo) => {
83-
const card = createCard(userInfo);
88+
const card = createCard({
89+
id: userInfo.id,
90+
name: userInfo.name,
91+
image: userInfo.avatar,
92+
description: userInfo.custom.role
93+
});
8494
success(card);
8595
})
8696
.catch((error) => console.error(error));
8797
};
8898

8999
const mentions_menu_hover = async (userInfo, success) => {
90-
const card = createCard(userInfo)
100+
const card = createCard(userInfo);
91101
success(card);
92102
};
93103

modules/ROOT/examples/live-demos/comments-embedded-with-mentions/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ const mentions_fetch = async (query, success) => {
44
const searchPhrase = query.term.toLowerCase();
55
await fetch(`${API_URL}?q=${encodeURIComponent(searchPhrase)}`)
66
.then((response) => response.json())
7-
.then((users) => success(users.data))
7+
.then((users) => success(users.data.map((userInfo) => ({
8+
id: userInfo.id,
9+
name: userInfo.name,
10+
image: userInfo.avatar,
11+
description: userInfo.custom.role
12+
}))))
813
.catch((error) => console.log(error));
914
};
1015

@@ -33,14 +38,19 @@ const mentions_select = async (mention, success) => {
3338
await fetch(`${API_URL}/${id}`)
3439
.then((response) => response.json())
3540
.then((userInfo) => {
36-
const card = createCard(userInfo);
41+
const card = createCard({
42+
id: userInfo.id,
43+
name: userInfo.name,
44+
image: userInfo.avatar,
45+
description: userInfo.custom.role
46+
});
3747
success(card);
3848
})
3949
.catch((error) => console.error(error));
4050
};
4151

4252
const mentions_menu_hover = async (userInfo, success) => {
43-
const card = createCard(userInfo)
53+
const card = createCard(userInfo);
4454
success(card);
4555
};
4656

modules/ROOT/examples/live-demos/mentions/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
const API_URL = 'https://demouserdirectory.tiny.cloud/users';
1+
const API_URL = 'https://demouserdirectory.tiny.cloud/v1/users';
22

33
const mentions_fetch = async (query, success) => {
44
const searchPhrase = query.term.toLowerCase();
55
await fetch(`${API_URL}?q=${encodeURIComponent(searchPhrase)}`)
66
.then((response) => response.json())
7-
.then((users) => success(users.data))
7+
.then((users) => success(users.data.map((userInfo) => ({
8+
id: userInfo.id,
9+
name: userInfo.name,
10+
image: userInfo.avatar,
11+
description: userInfo.custom.role
12+
}))))
813
.catch((error) => console.log(error));
914
};
1015

@@ -33,14 +38,19 @@ const mentions_select = async (mention, success) => {
3338
await fetch(`${API_URL}/${id}`)
3439
.then((response) => response.json())
3540
.then((userInfo) => {
36-
const card = createCard(userInfo);
41+
const card = createCard({
42+
id: userInfo.id,
43+
name: userInfo.name,
44+
image: userInfo.avatar,
45+
description: userInfo.custom.role
46+
});
3747
success(card);
3848
})
3949
.catch((error) => console.error(error));
4050
};
4151

4252
const mentions_menu_hover = async (userInfo, success) => {
43-
const card = createCard(userInfo)
53+
const card = createCard(userInfo);
4454
success(card);
4555
};
4656

0 commit comments

Comments
 (0)