@@ -19,17 +22,20 @@ import type { MovieList } from "~/types/movielist";
const lists = defineModel("movie_list", { default: [] });
const updateLists = async function () {
let config = useRuntimeConfig();
- const { data, status, error } = await useFetch(
+ const { data, error } = await useFetch(
`${config.public.apiURL}/lists`,
{
method: "GET",
- headers: { "Content-type": "application/json" },
+ headers: {
+ "Content-type": "application/json",
+ Authorization: `Token ${useCookie("token").value}`,
+ },
},
);
if (error) {
if (error.value?.statusCode === 401) {
- console.log("unauthorized");
+ navigateTo("/");
}
} else {
lists.value = data.value || [];