lists page now pulls real data
This commit is contained in:
parent
890df1ee51
commit
629e950e60
2 changed files with 35 additions and 5 deletions
|
|
@ -1,12 +1,32 @@
|
|||
<script lang="ts" setup>
|
||||
const emit = defineEmits(['refreshLists']);
|
||||
const refreshLists = () => emit('refreshLists');
|
||||
const listName = ref("");
|
||||
|
||||
const createList = () => {
|
||||
$api('/api/movielists', {
|
||||
body: {
|
||||
name: listName.value,
|
||||
},
|
||||
method: "POST"
|
||||
}).then(() => {
|
||||
listName.value = "";
|
||||
refreshLists();
|
||||
}).catch((error) => {
|
||||
if (error.response?.status === 401) {
|
||||
useAuth().logout();
|
||||
}
|
||||
alert(error.message)
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form>
|
||||
<form @submit.prevent="createList">
|
||||
<label for="list_name">Add List</label>
|
||||
<div>
|
||||
<input class="" name="list_name"
|
||||
<input v-model="listName"
|
||||
name="list_name"
|
||||
placeholder="List Name"
|
||||
type="text">
|
||||
<button>Add</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue