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 { MovieList } from "~/types/movielist";
|
||||||
import type { Movie } from "~/types/movie";
|
import type { Movie } from "~/types/movie";
|
||||||
import Modal from "~/components/Modal.vue";
|
import Modal from "~/components/Modal.vue";
|
||||||
|
import { useCookie } from "#app";
|
||||||
|
|
||||||
const list_id = ref(0);
|
const list_id = ref(0);
|
||||||
const list = defineModel<MovieList>("movie_list", { default: [] });
|
const list = defineModel<MovieList>("movie_list", { default: [] });
|
||||||
|
@ -83,12 +84,17 @@ const hide_scheduled = ref(false);
|
||||||
|
|
||||||
const getList = async function (list_id: number) {
|
const getList = async function (list_id: number) {
|
||||||
let config = useRuntimeConfig();
|
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}`, {
|
$fetch<MovieList>(`${config.public.apiURL}/lists/${list_id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: headers,
|
||||||
"Content-type": "application/json",
|
|
||||||
Authorization: `Token ${useCookie("token").value}`,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
list.value = data;
|
list.value = data;
|
||||||
|
|
|
@ -102,13 +102,17 @@ const getSchedule = async function (previous = false) {
|
||||||
let params = "";
|
let params = "";
|
||||||
if (previous) params = "?past_showings=true";
|
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}`, {
|
await $fetch(`${config.public.apiURL}/schedules/1${params}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: headers,
|
||||||
Accept: "application/json",
|
|
||||||
"Content-type": "application/json",
|
|
||||||
Authorization: `Token ${useCookie("token").value}`,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (previous) {
|
if (previous) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue