From bafe573f90a9fb3d30f5d53431487515feb2b386 Mon Sep 17 00:00:00 2001 From: Edward Tirado Jr Date: Tue, 22 Apr 2025 17:44:39 -0500 Subject: [PATCH 1/2] .idea update --- .idea/workspace.xml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 @@ - - - - From efb228639effb6501f2ff99cbda487adbcdc6bdf Mon Sep 17 00:00:00 2001 From: Edward Tirado Jr Date: Tue, 22 Apr 2025 17:45:34 -0500 Subject: [PATCH 2/2] updated request for lists and schedules for public view --- src/pages/lists/[id].vue | 14 ++++++++++---- src/pages/schedule/index.vue | 14 +++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) 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) {