fix: equipment: Remove broken ass page when any values return null
This commit is contained in:
parent
50a36e2db4
commit
68776ac3b0
2 changed files with 40 additions and 5 deletions
|
|
@ -253,11 +253,28 @@ window.loadHeader(async function(headerContainer) {
|
|||
handleFetch("/api/v1/me/equipment"),
|
||||
handleFetch("/api/v1/me/equipment/history")
|
||||
]);
|
||||
|
||||
await renderData(profileRes, false);
|
||||
await renderData(equipRes, false);
|
||||
await renderData({ history: Array.isArray(historyRes) ? historyRes : [] }, false);
|
||||
sessionStorage.setItem('user_cache', JSON.stringify(combinedData));
|
||||
|
||||
const hasNullFields = !equipRes || Object.values(equipRes).some(v => v === null);
|
||||
|
||||
if (hasNullFields) {
|
||||
await renderData(profileRes, false);
|
||||
if (infoBox) {
|
||||
infoBox.innerHTML = `
|
||||
<div class="info-message-box">
|
||||
<p>
|
||||
To use this service, it is required for you to play at least one game on Splatfestival Network.
|
||||
Play a match on your Wii U on Splatoon!<br><br>
|
||||
|
||||
Note: if this service does not support Cemu due to how the emulator does not support POST requests.
|
||||
</p>
|
||||
</div>`;
|
||||
}
|
||||
} else {
|
||||
await renderData(profileRes, false);
|
||||
await renderData(equipRes, false);
|
||||
await renderData({ history: Array.isArray(historyRes) ? historyRes : [] }, false);
|
||||
sessionStorage.setItem('user_cache', JSON.stringify(combinedData));
|
||||
}
|
||||
} catch (err) {
|
||||
if (cacheFound) {
|
||||
await renderData(sessionStorage.getItem('user_cache'), true);
|
||||
|
|
|
|||
|
|
@ -164,6 +164,24 @@ body {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.info-message-box {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
border-radius: 10px;
|
||||
padding: 25px 40px;
|
||||
max-width: 700px;
|
||||
margin: 40px auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.info-message-box p {
|
||||
color: #ffffff;
|
||||
font-family: "Regular", sans-serif;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#scale-root {
|
||||
width: 1044px;
|
||||
height: 600px;
|
||||
|
|
|
|||
Loading…
Reference in a new issue