diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b4d0069..ee5cbf9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,11 +6,7 @@
-
-
-
-
@@ -67,7 +63,7 @@
"RunOnceActivity.git.unshallow": "true",
"WebServerToolWindowFactoryState": "false",
"code.cleanup.on.save": "true",
- "git-widget-placeholder": "usefetch-to-fetch",
+ "git-widget-placeholder": "unauthenticated-requests",
"last_opened_file_path": "/home/tiradoe/Projects/movie-night/web/src/types",
"list.type.of.created.stylesheet": "CSS",
"node.js.detected.package.eslint": "true",
@@ -112,8 +108,8 @@
-
-
+
+
@@ -137,6 +133,7 @@
+
diff --git a/src/pages/lists/[id].vue b/src/pages/lists/[id].vue
index 77b717d..e662f5c 100644
--- a/src/pages/lists/[id].vue
+++ b/src/pages/lists/[id].vue
@@ -69,6 +69,7 @@ import "lazysizes";
import type { MovieList } from "~/types/movielist";
import type { Movie } from "~/types/movie";
import Modal from "~/components/Modal.vue";
+import { useCookie } from "#app";
const list_id = ref(0);
const list = defineModel("movie_list", { default: [] });
@@ -83,12 +84,17 @@ const hide_scheduled = ref(false);
const getList = async function (list_id: number) {
let config = useRuntimeConfig();
+ let headers: any = {
+ "Content-type": "application/json",
+ };
+
+ if (typeof useCookie("token").value !== "undefined") {
+ headers["Authorization"] = `Token ${useCookie("token").value}`;
+ }
+
$fetch(`${config.public.apiURL}/lists/${list_id}`, {
method: "GET",
- headers: {
- "Content-type": "application/json",
- Authorization: `Token ${useCookie("token").value}`,
- },
+ headers: headers,
})
.then((data) => {
list.value = data;
diff --git a/src/pages/schedule/index.vue b/src/pages/schedule/index.vue
index 8cf2637..7c55c4c 100644
--- a/src/pages/schedule/index.vue
+++ b/src/pages/schedule/index.vue
@@ -102,13 +102,17 @@ const getSchedule = async function (previous = false) {
let params = "";
if (previous) params = "?past_showings=true";
+ let headers: any = {
+ "Content-type": "application/json",
+ };
+
+ if (typeof useCookie("token").value !== "undefined") {
+ headers["Authorization"] = `Token ${useCookie("token").value}`;
+ }
+
await $fetch(`${config.public.apiURL}/schedules/1${params}`, {
method: "GET",
- headers: {
- Accept: "application/json",
- "Content-type": "application/json",
- Authorization: `Token ${useCookie("token").value}`,
- },
+ headers: headers,
})
.then((data) => {
if (previous) {