updated request for lists and schedules for public view
This commit is contained in:
parent
bafe573f90
commit
efb228639e
2 changed files with 19 additions and 9 deletions
|
@ -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<MovieList>("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<MovieList>(`${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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue