Members
Type:
- Source:
Type:
- Source:
Type:
- Source:
name :string
Type:
- Source:
Methods
addEventToEditProfile()
Set the event to modal dialog
- Source:
addEventToLogin()
Attaches an event handler to the login form element.
- Source:
addEventToRegister()
Attaches an event handler to the register form element.
- Source:
Calculate distance and date parts between two dates.
Parameters:
| Name |
Type |
Description |
start |
number
|
|
end |
number
|
|
- Source:
Returns:
-
Type
-
CountdownResult
checkUserAuth()
check if the user is logged, otherwise redirect to login page
- Source:
countDown(intervalMs, date, callback)
Parameters:
| Name |
Type |
Description |
intervalMs |
number
|
Interval in milliseconds to calculate distance between now and the specified date. |
date |
Date
|
The reference date. |
callback |
CountdownCallback
|
|
- Source:
(async) createBid(amount, listingId) → {Promise.<(createBidResponse|null|undefined)>}
Create a new bid on listing.
Parameters:
| Name |
Type |
Description |
amount |
number
|
The bid amount |
listingId |
string
|
The bid amount |
- Source:
Returns:
If response is ok, return listings. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(createBidResponse|null|undefined)>
(async) createListing(listingData) → {Promise.<(createListingResponse|null|undefined)>}
Create a new user listing.
Parameters:
- Source:
Returns:
If response is ok, return listings. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(createListingResponse|null|undefined)>
(async) displayBids(username) → {Promise.<(Array.<GetProfileBidsDataResponse>|null|undefined)>}
Send a request to API
Parameters:
| Name |
Type |
Description |
username |
string
|
The user name |
- Source:
Returns:
If response is ok, return bids info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(Array.<GetProfileBidsDataResponse>|null|undefined)>
displayError(listingId, visible, textopt)
Shows or hides a info error message.
Parameters:
| Name |
Type |
Attributes |
Description |
listingId |
string
|
|
The error id. |
visible |
boolean
|
|
If true, shows the msg, otherwise hides it. |
text |
string
|
<optional>
|
The message to show, or `undefined` if `visible` is false. |
- Source:
displayError(visible, id, textopt)
Display a message error
Parameters:
| Name |
Type |
Attributes |
Description |
visible |
boolean
|
|
If true, shows the msg error, otherwise hides it. |
id |
string
|
|
Show error msg by id |
text |
string
|
<optional>
|
The message to show, or `undefined` if `visible` is false.
* @example
// Hide the error message
displayError(false); |
- Source:
Example
// Show the error message
displayError(true, "#errorPosts", 'Error message');
(async) displayListings() → {Promise.<(Array.<GetAuctionListingsDataResponse>|null|undefined)>}
Send a request to API
- Source:
Returns:
If response is ok, return listings info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(Array.<GetAuctionListingsDataResponse>|null|undefined)>
(async) displayListings(username) → {Promise.<(Array.<GetProfileListingDataResponse>|null|undefined)>}
Send a request to API
Parameters:
| Name |
Type |
Description |
username |
string
|
The user name |
- Source:
Returns:
If response is ok, return listings info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(Array.<GetProfileListingDataResponse>|null|undefined)>
displayLoginPassword()
Set the input type between text and password.
- Source:
displaySpinner(listingId, spinnerVisible)
Show and hide the spinner element
Parameters:
| Name |
Type |
Description |
listingId |
string
|
The listing id. |
spinnerVisible |
boolean
|
If true, shows the spinner, otherwise hides it. |
- Source:
displaySpinner(spinnerVisible, id)
Show and hide the spinner element
Parameters:
| Name |
Type |
Description |
spinnerVisible |
boolean
|
If true, shows the spinner, otherwise hides it. |
id |
string
|
Show spinner by id, otherwise hides it. |
- Source:
Displays the number of wins, the number of listings and the number of credits.
Parameters:
- Source:
(async) fetchUpdateProfile(username, avatarUrl) → {Promise.<(GetProfileDataResponse2|null|undefined)>}
Send a request to API
Parameters:
| Name |
Type |
Description |
username |
string
|
The user name |
avatarUrl |
string
|
The url of the user image/avatar |
- Source:
Returns:
If response is ok, return profile info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(GetProfileDataResponse2|null|undefined)>
Send a request to API
Parameters:
| Name |
Type |
Description |
username |
string
|
The user name |
- Source:
Returns:
If response is ok, return profile meta info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(GetProfileDataResponse|null|undefined)>
generateHtml(item) → {Object}
Map a listing to html content
Parameters:
- Source:
Returns:
Return the object listing
-
Type
-
Object
getErrorMessage() → {Promise.<string>}
Convert the API response errors msg in a human readable way.
- Source:
Returns:
If the response is ok, return a empty string. Otherwise return a string msg.
-
Type
-
Promise.<string>
It returns the profile information from local storage.
- Source:
Returns:
Returns the profile info.
-
Type
-
ProfileInfo
handleBidSubmit(listingId, ev)
Handle the form bid submit.
Parameters:
| Name |
Type |
Description |
listingId |
string
|
The bid amount |
ev |
Event
|
|
- Source:
handleSearch(ev)
Handle the button search click.
Parameters:
| Name |
Type |
Description |
ev |
Event
|
|
- Source:
Handle the search submit.
Parameters:
| Name |
Type |
Description |
ev |
*
|
|
- Source:
handleSubmit(ev)
Handle the form submit.
Parameters:
| Name |
Type |
Description |
ev |
Event
|
|
- Source:
listingsHandleOrderBy(ev)
Sort the user array listings by a specified key
Parameters:
| Name |
Type |
Description |
ev |
Event
|
The event from the `select` element. |
- Source:
Example
// if the select value is 'title', it return the listings sorted alphabetically a-z.
// if the select value is 'newest', it returns the newest listings first.
// if the select value is 'oldest', it returns the oldest listings first.
listingsHandleOrderBy(ev)
Sort the user array bids by a specified key
Parameters:
| Name |
Type |
Description |
ev |
Event
|
The event from the `select` element. |
- Source:
Example
// if the select value is 'title', it return the bids sorted alphabetically a-z.
// if the select value is 'newest', it returns the newest bids first.
// if the select value is 'oldest', it returns the oldest bids first.
load(key) → {object|null}
Get key from local storage
Parameters:
| Name |
Type |
Description |
key |
string
|
The object key |
- Source:
Returns:
If the key exists, return a JSON object. Otherwise returns null.
-
Type
-
object
|
null
(async) login(email, password) → {Promise.<(LoginResponse|null|undefined)>}
Send a request to login the user
Parameters:
| Name |
Type |
Description |
email |
string
|
User email |
password |
string
|
User password |
- Source:
Returns:
If response is ok, return the user info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(LoginResponse|null|undefined)>
(async) register(name, email, psw) → {Promise.<(RegisterResponse|null|undefined)>}
This function send a request to register a new user return
Parameters:
| Name |
Type |
Description |
name |
string
|
user name |
email |
string
|
user email |
psw |
string
|
user password |
- Source:
Returns:
If response is ok, return the user info. If response is not ok, return null. Returns undefined for unexpected errors.
-
Type
-
Promise.<(RegisterResponse|null|undefined)>
remove(key)
Remove the key from local storage
Parameters:
| Name |
Type |
Description |
key |
string
|
The key to be deleted. |
- Source:
(async) requestAPIKey() → {Promise.<(any|undefined)>}
This function send a request to register a new tenant. Should be used only once per user.
- Source:
Returns:
If response is ok, return the tenant key. Otherwise it throws.
-
Type
-
Promise.<(any|undefined)>
sanitize(html) → {string}
Sanitize a html string to be safe to use
Parameters:
| Name |
Type |
Description |
html |
string
|
The html string to be sanitized. |
- Source:
Returns:
Returns the result of html sanitization.
-
Type
-
string
Examples
// returns 'Hi';
const sanitized = sanitize('<script></script>Hi');
// returns '<p>Hi</p>';
const sanitized = sanitize('<p>Hi</p>');
save(key, value)
Save in the local storage
Parameters:
| Name |
Type |
Description |
key |
string
|
The object key |
value |
string
|
object
|
The object to be saved. |
- Source:
(async) searchPosts(text) → {Promise.<(Array.<GetAuctionListingsDataResponse>|null|undefined)>}
Returns all listings that does match the search text
Parameters:
| Name |
Type |
Description |
text |
string
|
The string to search for |
- Source:
Returns:
Returns an array if the fetch is successful, otherwise it returns null for response not ok. It returns undefined for unexpected errors.
-
Type
-
Promise.<(Array.<GetAuctionListingsDataResponse>|null|undefined)>
Example
// returns a Promise with an array of listings
const posts = await searchPosts("Travel");
showListingChar(ev)
Show many characters remaining
Parameters:
| Name |
Type |
Description |
ev |
Event
|
|
- Source:
statusMsg(listingId, visible, textopt)
Shows or hides a info message.
Parameters:
| Name |
Type |
Attributes |
Description |
listingId |
string
|
|
The listing id. |
visible |
boolean
|
|
If true, shows the msg, otherwise hides it. |
text |
string
|
<optional>
|
The message to show, or `undefined` if `visible` is false. |
- Source:
statusMsg(visible, textopt)
Shows or hides a info message.
Parameters:
| Name |
Type |
Attributes |
Description |
visible |
boolean
|
|
If true, shows the msg, otherwise hides it. |
text |
string
|
<optional>
|
The message to show, or `undefined` if `visible` is false. |
- Source:
updateBids(data)
Map a listing to html content
Parameters:
- Source:
updateListings(data, searchInput)
Display listings, filtered by searchInput.
Parameters:
| Name |
Type |
Description |
data |
Array.<(GetAuctionListingsDataResponse|undefined)>
|
Listings to be shown. |
searchInput |
string
|
The text to be found. If empty returns all listings. |
- Source:
updateListings(data)
Map a listing to html content
Parameters:
- Source:
updateProfile(avatarUrl, username, bio)
Update user avatar, name and bio
Parameters:
| Name |
Type |
Description |
avatarUrl |
string
|
The url of the user image/avatar |
username |
string
|
The user name |
bio |
string
|
The user bio |
- Source:
Type Definitions
BadRequestResponse
Type:
Properties:
| Name |
Type |
Description |
errors |
Array.<object>
|
Properties
| Name |
Type |
Description |
message |
string
|
|
|
status |
string
|
|
statusCode |
number
|
|
- Source:
CountdownCallback(data)
Callback for adding two numbers.
Parameters:
- Source:
CountdownResult
Type:
Properties:
| Name |
Type |
Description |
distance |
number
|
|
days |
number
|
|
hours |
number
|
|
minutes |
number
|
|
seconds |
number
|
|
- Source:
GetAuctionListingsDataResponse
Type:
Properties:
| Name |
Type |
Description |
id |
string
|
|
title |
string
|
|
description |
string
|
|
media |
Array.<object>
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
tags |
Array.<string>
|
|
created |
string
|
|
updated |
string
|
|
endsAt |
string
|
|
bids |
Array.<object>
|
Properties
| Name |
Type |
Description |
id |
string
|
|
amount |
number
|
|
bidder |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
string
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
created |
string
|
|
|
seller |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
null
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
bids |
number
|
|
|
- Source:
GetAuctionListingsDataResponse
Type:
Properties:
| Name |
Type |
Description |
id |
string
|
|
title |
string
|
|
description |
string
|
|
media |
Array.<object>
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
tags |
Array.<string>
|
|
created |
string
|
|
updated |
string
|
|
endsAt |
string
|
|
bids |
Array.<object>
|
Properties
| Name |
Type |
Description |
id |
string
|
|
amount |
number
|
|
bidder |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
string
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
created |
string
|
|
|
seller |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
null
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
bids |
number
|
|
|
- Source:
GetAuctionListingsResponse
Type:
Properties:
- Source:
GetAuctionListingsResponse
Type:
Properties:
- Source:
GetProfileBidsDataResponse
/* @type {object}
Type:
Properties:
| Name |
Type |
Description |
id |
string
|
|
amount |
number
|
|
bidder |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
null
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
created |
string
|
|
listing |
object
|
Properties
| Name |
Type |
Description |
id |
string
|
|
title |
string
|
|
description |
string
|
|
created |
string
|
|
updated |
string
|
|
endsAt |
string
|
|
|
listings.tags |
Array.<string>
|
|
- Source:
/* @type
Type:
Properties:
| Name |
Type |
Description |
isFirstPage |
boolean
|
|
isLastPage |
boolean
|
|
currentPage |
number
|
|
previousPage |
null
|
|
nextPage |
null
|
|
pageCount |
number
|
|
totalCount |
number
|
|
- Source:
GetProfileBidsResponse
Type:
Properties:
- Source:
GetProfileDataResponse
// @type {object}
Type:
Properties:
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
string
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
credits |
number
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
listings |
number
|
|
wins |
number
|
|
|
- Source:
GetProfileDataResponse2
Type:
Properties:
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
string
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
credits |
number
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
listings |
number
|
|
wins |
number
|
|
|
- Source:
GetProfileListingDataResponse
// @type {object}
Type:
Properties:
| Name |
Type |
Description |
id |
string
|
|
title |
string
|
|
description |
string
|
|
media |
Array.<object>
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
tags |
Array.<string>
|
|
created |
string
|
|
updated |
string
|
|
endsAt |
string
|
|
seller |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
string
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
bids |
number
|
|
|
- Source:
// @type
Type:
Properties:
| Name |
Type |
Description |
isFirstPage |
boolean
|
|
isLastPage |
boolean
|
|
currentPage |
number
|
|
previousPage |
null
|
|
nextPage |
null
|
|
pageCount |
number
|
|
totalCount |
number
|
|
- Source:
GetProfileListingsResponse
Type:
Properties:
- Source:
Type:
Properties:
| Name |
Type |
Description |
isFirstPage |
boolean
|
|
isLastPage |
boolean
|
|
currentPage |
number
|
|
previousPage |
null
|
|
nextPage |
null
|
|
pageCount |
number
|
|
totalCount |
number
|
|
- Source:
Type:
- Source:
GetProfileResponse
Type:
Properties:
- Source:
GetProfileResponse2
Type:
Properties:
- Source:
LoginResponse
Type:
Properties:
| Name |
Type |
Description |
data |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
null
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
accessToken |
string
|
|
|
- Source:
ProfileInfo
Type:
Properties:
| Name |
Type |
Description |
name |
string
|
|
bio |
string
|
|
avatarUrl |
string
|
|
- Source:
RegisterResponse
Type:
Properties:
| Name |
Type |
Description |
data |
object
|
Properties
| Name |
Type |
Description |
name |
string
|
|
email |
string
|
|
bio |
string
|
|
avatar |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
banner |
object
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
|
- Source:
createBidRequest
/* @typed {object}
Type:
Properties:
| Name |
Type |
Description |
amount |
number
|
|
- Source:
createBidResponse
/* @typed {object}
Type:
Properties:
| Name |
Type |
Description |
id |
string
|
|
title |
string
|
|
description |
string
|
|
tags |
Array.<string>
|
|
media |
Array.<object>
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
created |
string
|
|
updated |
string
|
|
endsAt |
string
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
bids |
number
|
|
|
- Source:
createListingRequest
Type:
Properties:
| Name |
Type |
Description |
title |
string
|
|
description |
string
|
|
tags |
Array.<string>
|
|
media |
Array.<object>
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
endsAt |
string
|
|
- Source:
createListingResponse
Type:
Properties:
| Name |
Type |
Description |
data |
object
|
Properties
| Name |
Type |
Description |
id |
string
|
|
title |
string
|
|
description |
string
|
|
media |
Array.<object>
|
Properties
| Name |
Type |
Description |
url |
string
|
|
alt |
string
|
|
|
tags |
Array.<string>
|
|
created |
string
|
|
updated |
string
|
|
endsAt |
string
|
|
_count |
object
|
Properties
| Name |
Type |
Description |
bids |
number
|
|
|
|
- Source: