File tree Expand file tree Collapse file tree 3 files changed +40
-10
lines changed
modules/ROOT/examples/live-demos Expand file tree Collapse file tree 3 files changed +40
-10
lines changed Original file line number Diff line number Diff 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
8999const mentions_menu_hover = async ( userInfo , success ) => {
90- const card = createCard ( userInfo )
100+ const card = createCard ( userInfo ) ;
91101 success ( card ) ;
92102} ;
93103
Original file line number Diff line number Diff 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
4252const mentions_menu_hover = async ( userInfo , success ) => {
43- const card = createCard ( userInfo )
53+ const card = createCard ( userInfo ) ;
4454 success ( card ) ;
4555} ;
4656
Original file line number Diff line number Diff line change 1- const API_URL = 'https://demouserdirectory.tiny.cloud/users' ;
1+ const API_URL = 'https://demouserdirectory.tiny.cloud/v1/ users' ;
22
33const 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
4252const mentions_menu_hover = async ( userInfo , success ) => {
43- const card = createCard ( userInfo )
53+ const card = createCard ( userInfo ) ;
4454 success ( card ) ;
4555} ;
4656
You can’t perform that action at this time.
0 commit comments