diff --git a/src/scripts/auth-guard.js b/src/scripts/auth-guard.js new file mode 100644 index 0000000..dc04043 --- /dev/null +++ b/src/scripts/auth-guard.js @@ -0,0 +1,7 @@ +(function () { + const token = localStorage.getItem("token"); + + if (!token && window.location.pathname !== "/") { + window.location.href = "/"; + } +})(); diff --git a/views/anime/anime.html b/views/anime/anime.html index 7516825..bef54ba 100644 --- a/views/anime/anime.html +++ b/views/anime/anime.html @@ -155,6 +155,8 @@ + + \ No newline at end of file diff --git a/views/anime/animes.html b/views/anime/animes.html index cc167d6..b4c2be8 100644 --- a/views/anime/animes.html +++ b/views/anime/animes.html @@ -132,5 +132,6 @@ + \ No newline at end of file diff --git a/views/anime/watch.html b/views/anime/watch.html index 349f055..3fa6809 100644 --- a/views/anime/watch.html +++ b/views/anime/watch.html @@ -191,5 +191,6 @@ + \ No newline at end of file diff --git a/views/books/book.html b/views/books/book.html index ed140b6..cccef88 100644 --- a/views/books/book.html +++ b/views/books/book.html @@ -139,5 +139,6 @@ + \ No newline at end of file diff --git a/views/books/books.html b/views/books/books.html index 749cc37..e058ab7 100644 --- a/views/books/books.html +++ b/views/books/books.html @@ -108,5 +108,6 @@ + \ No newline at end of file diff --git a/views/books/read.html b/views/books/read.html index cfd6932..189ee4f 100644 --- a/views/books/read.html +++ b/views/books/read.html @@ -202,5 +202,6 @@ + \ No newline at end of file diff --git a/views/gallery/gallery.html b/views/gallery/gallery.html index 7b875f3..3e78374 100644 --- a/views/gallery/gallery.html +++ b/views/gallery/gallery.html @@ -95,5 +95,6 @@ + \ No newline at end of file diff --git a/views/gallery/image.html b/views/gallery/image.html index 63d66f0..39f69e8 100644 --- a/views/gallery/image.html +++ b/views/gallery/image.html @@ -80,5 +80,6 @@ + \ No newline at end of file diff --git a/views/marketplace.html b/views/marketplace.html index b7c0ebd..d060326 100644 --- a/views/marketplace.html +++ b/views/marketplace.html @@ -120,5 +120,6 @@ + \ No newline at end of file diff --git a/views/schedule.html b/views/schedule.html index c07f230..ebff669 100644 --- a/views/schedule.html +++ b/views/schedule.html @@ -108,5 +108,6 @@ + \ No newline at end of file