$ npm i axios
OMDB 에서 http를 요청하기 위함이다.
XHR : XMLHttpRequest 의 약어로 웹 브라우저와 웹 서버 간에 데이터 전송 API 이다.
// input 에 추가
**@keyup.enter="apply"**
// btn 에 추가
**@click="apply"**
// script 에 추가
import axios from 'axios'
// methos 추가. console 창에서 결과 확인한다.
methods: {
async apply() {
// Search Movies!
const OMDB_API_KEY = '7035c60c'
const res = await axios.get(`https://www.omdbapi.com/?apikey=${OMDB_API_KEY}&s=${this.title}&type=${this.type}&y=${this.year}&page=1`)
console.log(res)
}
}
// btn 의 사이즈가 자리가 없어서 줄어들었다. 줄어들지 않게 해 주기 위해 추가
.btn {
width: 120px;
height: 50px;
font-weight: 700;
flex-shrink: 0;
}