mirror of
https://github.com/journey-ad/Moe-Counter.git
synced 2024-11-27 17:00:51 +01:00
feat(web): show message on error
This commit is contained in:
parent
41bf6caeb8
commit
97c529e540
@ -31,11 +31,25 @@
|
||||
}
|
||||
|
||||
const query = new URLSearchParams(params).toString();
|
||||
img.src = `${__global_data.site}/@${name}?${query}`;
|
||||
code.textContent = img.src;
|
||||
code.style.visibility = 'visible';
|
||||
const imgSrc = `${__global_data.site}/@${name}?${query}`;
|
||||
img.src = imgSrc
|
||||
|
||||
img.onload = () => img.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
||||
img.onload = () => {
|
||||
img.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
||||
|
||||
code.textContent = imgSrc;
|
||||
code.style.visibility = 'visible';
|
||||
}
|
||||
|
||||
img.onerror = () => {
|
||||
fetch(imgSrc)
|
||||
.then(async (res) => {
|
||||
if (!res.ok) {
|
||||
const { message } = await res.json();
|
||||
alert(message);
|
||||
}
|
||||
})
|
||||
};
|
||||
}, 500));
|
||||
|
||||
code.addEventListener('click', (e) => {
|
||||
|
Loading…
Reference in New Issue
Block a user