fix cors error

This commit is contained in:
Francesco Grazioso 2024-05-04 18:54:49 +02:00
parent ef88dd1da5
commit d269cde308
4 changed files with 9 additions and 6 deletions

View File

@ -130,7 +130,7 @@ CORS_ALLOWED_ORIGINS = [
"http://localhost:5173", "http://localhost:5173",
] ]
CORS_ALLOW_METHODS = ( CORS_ALLOWED_METHODS = (
"DELETE", "DELETE",
"GET", "GET",
"OPTIONS", "OPTIONS",

View File

@ -1,7 +1,7 @@
import axios from 'axios' import axios from 'axios'
import type {MediaItemResponse} from '@/api/interfaces' import type {MediaItemResponse} from '@/api/interfaces'
const BASE_URL = 'http://127.0.0.1:8000/api' const BASE_URL = 'http://localhost:8000/api'
function get(url: string): Promise<any> { function get(url: string): Promise<any> {
return axios.get(`${BASE_URL}${url}`) return axios.get(`${BASE_URL}${url}`)

View File

@ -19,7 +19,7 @@ const toggleOption = () => {
<template> <template>
<div class="switch-container"> <div class="switch-container">
<span class="switch-label-left">Film</span> <span class="switch-label-left">Film/Serie TV</span>
<label class="switch"> <label class="switch">
<input type="checkbox" :checked="isAnimeSelected" @change="toggleOption"> <input type="checkbox" :checked="isAnimeSelected" @change="toggleOption">
<span class="slider round"></span> <span class="slider round"></span>

View File

@ -45,19 +45,22 @@ function searchTitle() {
@submit="searchTitle" @submit="searchTitle"
class="search-input" class="search-input"
type="text" type="text"
placeholder="Search for a title..." placeholder="Cerca un titolo..."
/> />
<div class="toggle-button-container"> <div class="toggle-button-container">
<Toggle v-model="selectedOption" class="search-toggle"></Toggle> <Toggle v-model="selectedOption" class="search-toggle"></Toggle>
<button @click="searchTitle" class="search-button">Search</button> <button @click="searchTitle" class="search-button">Cerca</button>
</div> </div>
</div> </div>
</div> </div>
<div class="card-container"> <div v-if="searchResults && searchResults.length > 0" class="card-container">
<div v-for="result in searchResults" :key="result.id" class="card-item"> <div v-for="result in searchResults" :key="result.id" class="card-item">
<Card :item="result" :media-type="selectedOption" /> <Card :item="result" :media-type="selectedOption" />
</div> </div>
</div> </div>
<div v-else>
<p style="text-align: center; margin-top: 100px;">Nessun risultato trovato</p>
</div>
</template> </template>
<style scoped> <style scoped>