Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createStandBlock(stand) {
- const standUrl = urlTemplate.replace('{0}', stand.standId);
- const changeCompanyIdPath = changeCompanyIdPathTemplate.replace('{0}', stand.companyId);
- function handleClick(event) {
- event.preventDefault();
- console.log(event);
- //location.href = event.target.href;
- const axiosConfig = {
- headers: {
- 'Content-Type': 'application/json;charset=UTF-8',
- 'Access-Control-Allow-Origin': true,
- 'Access-Control-Allow-Credentials': true,
- }
- };
- axios
- .post(`${standUrl}/${changeCompanyIdPath}`, {}, axiosConfig)
- .then(response => { location.href = event.target.href; })
- .catch(error => console.log(error));
- }
- return hyperHTML.wire()`
- <div class='stand-block' style='background-color: #${stand.color}'>
- <a href='${standUrl}' title='${stand.name}' onclick='${handleClick}'>
- ${stand.name}
- </a>
- <div>
- `;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement