Commit bc3ee7b9 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

오류수정 및 reservation

parent 31cef7c3
......@@ -29,7 +29,7 @@ const Collection = ({ TMDB_TopRated_Data }) => {
?
<div className="">
<div className="ratio ratio-16x9">
<iframe src={`https://www.youtube.com/embed/${videoUrls[0].key}`} title="YouTube video" allowfullscreen></iframe>
<iframe src={`https://www.youtube.com/embed/${videoUrls[0].key}`} title="YouTube video" allowFullScreen></iframe>
</div>
</div>
......
import { useRef, useState, useEffect } from 'react'
import cinemaApi from "../apis/cinema.api,js"
import cinemaApi from "../apis/cinema.api.js"
import theaterApi from "../apis/theater.api.js"
import catchErrors from "../utils/catchErrors"
......
......@@ -2,8 +2,6 @@ import { useState, useEffect } from 'react'
import movieApi from '../../apis/movie.api'
import catchErrors from '../../utils/catchErrors'
import styles from "./ticketingMovie.module.scss"
import movieApi from '../../apis/movie.api'
import catchErrors from '../../utils/catchErrors'
const TicketingMovie = ({ ticketInfo, setTicketInfo }) => {
const [movieList, setMovieList] = useState([])
......
......@@ -26,7 +26,7 @@ const Video = ({ movieId }) => {
<div className="mt-5 pb-5">
<p>{el.name}</p>
<div class="ratio ratio-16x9">
<iframe src={`https://www.youtube.com/embed/${el.key}`} title="YouTube video" allowfullscreen></iframe>
<iframe src={`https://www.youtube.com/embed/${el.key}`} title="YouTube video" allowFullScreen></iframe>
</div>
</div>
))
......
......@@ -25,15 +25,11 @@ const PaymentCompletePage = () => {
async function saveGuestReservation() {
try {
const response = await axios.get(`/api/auth/guestinfo/${user.id}`);
// const response2 = await reservationApi.save({
// userType: "guest",
// user: user.id,
// ...paymentData,
// timetableId: 1
// })
// if (response.data) {
const response2 = await reservationApi.findOneReservation()
console.log("예매내역=====",response2)
// if (response.data||response2) {
// const responseEmail = await axios.post('/api/email/send', {
// reservationData: [...response2.data],
// reservationData: response2,
// userData: { ...response.data },
// cinema: "Butter Studio 조치원",
// title: "더 수어사이드 스쿼드",
......@@ -42,7 +38,6 @@ const PaymentCompletePage = () => {
// })
// console.log(responseEmail.data)
// }
console.log(response.data)
} catch (error) {
catchErrors(error, setError)
}
......
......@@ -113,7 +113,7 @@ const Payment = ({ location }) => {
fail_url: 'http://localhost:3000/ticket',
cancel_url: 'http://localhost:3000/ticket',
})
if (responsekakao) {
if (response||responsekakao) {
localStorage.setItem('tid',responsekakao.data.tid)
window.location.href = responsekakao.data.redirect_url
}
......@@ -129,6 +129,7 @@ const Payment = ({ location }) => {
return (
<div className="container" style={{ color: "white" }}>
{console.log(ticketInfo)}
<div className="row justify-content-center my-5">
<div className="col-sm-4 ">
<h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>결제하기</h3>
......
......@@ -12,7 +12,7 @@ const TicketingPage = ({ location }) => {
const [ticketInfo, setTicketInfo] = useState({
...location.state,
cinema: "",
selectedTheater: "1",
selectedTheater: 1,
time: "2021/07/21 10:00"
})
const [cinemaInfo, setCinemaInfo] = useState({})
......
......@@ -40,12 +40,13 @@ const TicketingSeatPage = ({ location }) => {
async function getInfo() {
try {
setError("")
const response = await axios.post('/api/theater/getInfo', {
theaterId: ticketInfo.selectedTheater
})
setTheaterInfo(response.data)
const response2 = await reservationApi.findReservedSeats(1);
const reserve = response2.data.map((el) =>
const reserve = response2.map((el) =>
el.row + '-' + el.col
);
setReservedSeats(reserve);
......@@ -56,6 +57,7 @@ const TicketingSeatPage = ({ location }) => {
async function getTicketFee() {
try {
setError("")
const response3 = await axios.get(`/api/info/ticketfee`, {
params: {
theaterTypeId: theaterInfo.theatertypeId
......
......@@ -5,7 +5,7 @@ import config from '../config/app.config.js'
const findReservedSeats = async (req, res) => {
try {
const { timeTable } = req.body
console.log("타임테이블===============",timeTable)
console.log("타임테이블===============", timeTable)
const reservedSeats = await Reservation.findAll({
where: {
timetableId: timeTable
......@@ -51,7 +51,7 @@ const findOneReservation = async (req, res, next) => {
}
const saveReservation = async (req, res) => {
try {
const { movieId, selectedTheater, timetable, payment, user, userType, totalFee } = req.body
const { movieId, selectedTheater, timetableId, payment, user, userType, totalFee } = req.body
const rows = req.body.selectedSeats.map(el => el.split('-')[0])
const cols = req.body.selectedSeats.map(el => el.split('-')[1])
for (let index = 0; index < rows.length; index++) {
......@@ -59,10 +59,10 @@ const saveReservation = async (req, res) => {
user: user,
userType: userType,
movieId: movieId,
theaterId: selectedTheater,
row: rows[index],
col: cols[index],
timetableId: timetable,
timetableId: timetableId,
theaterId: selectedTheater,
payment: payment,
totalFee: totalFee,
})
......
......@@ -472,7 +472,7 @@ const saveGuestInfo = async (req, res) => {
roleId:1
});
res.clearCookie(config.cookieName);
const token = jwt.sign({id: newGuest.id, role: "user"}, config.jwtSecret, {
const token = jwt.sign({id: newGuest.id, role: "guest"}, config.jwtSecret, {
expiresIn: config.jwtExpires,
});
res.cookie(config.cookieName,token , {
......
......@@ -11,9 +11,6 @@ const ReservationModel = (sequelize) => {
primaryKey: true,
autoIncrement: true,
},
tid:{
type: DataTypes.STRING,
},
movieId: {
type: DataTypes.INTEGER,
},
......
import express from "express";
import multer from "multer";
import userCtrl from "../controllers/user.controller.js";
import multer from "multer"
const router = express.Router();
const upload = multer({
dest: "upload/"
})
router
.route("/user")
.get(userCtrl.getUser)
const upload = multer({
dest: "upload/"
})
router
.route("/user")
.get(userCtrl.getUser)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment