mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-12-24 01:13:46 +03:00
Fixed the code. I did the removal of unnecessary reits, the date is no longer transmitted as a number, now as a string
This commit is contained in:
parent
2478b6907e
commit
2f2046a8ae
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
|||
function load(date) {
|
||||
fetch(`https://api.starlio.space/wallpaper/${date}`).then(res => {
|
||||
res.json().then(data => {
|
||||
console.log(data);
|
||||
if (data.length === 0) return;
|
||||
|
||||
document.querySelector("div.wallpaper img").src = data.url;
|
||||
|
@ -13,12 +12,13 @@ function load(date) {
|
|||
}
|
||||
|
||||
function parseURL() {
|
||||
const pathname = document.location.pathname
|
||||
let pathname = document.location.pathname
|
||||
pathname = pathname.slice(pathname.lastIndexOf('/')+1)
|
||||
|
||||
if (isNaN(new Date(pathname).getTime())) return null;
|
||||
if (!isValidDate(pathname)) return null;
|
||||
|
||||
return Number(pathname);
|
||||
return pathname;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue