Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #68 from KnS-hacks/Umin
Browse files Browse the repository at this point in the history
[Fix]::CORS ERROR Fix git add .
  • Loading branch information
qhahd78 authored Jan 4, 2022
2 parents ab3c715 + 043414d commit 41fa93a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/api/Restaurant.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import api from './api';
export const restaurantDetail = async param => {
const res = await api({
url: `/restaurant/${param}`,
type: 'get',
type: 'GET',
param,
});
return res;
Expand All @@ -16,7 +16,7 @@ export const restaurantDetail = async param => {
export const waitingCreate = async param => {
const res = await api({
url: '/waiting',
type: 'post',
type: 'POST',
param,
});
return res;
Expand All @@ -26,7 +26,7 @@ export const waitingCreate = async param => {
export const restaurantSearch = async param => {
const res = await api({
url: `/restaurant?key=${param}`,
type: 'get',
type: 'GET',
param,
});
return res;
Expand All @@ -36,7 +36,7 @@ export const restaurantSearch = async param => {
export const restaurantList = async param => {
const res = await api({
url: `/restaurant?district=${param}`,
type: 'get',
type: 'GET',
param,
});
return res;
Expand Down
10 changes: 5 additions & 5 deletions src/api/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import api from './api';
export const userLogin = async param => {
const res = await api({
url: '/login',
type: 'post',
type: 'POST',
param,
});
return res;
Expand All @@ -16,7 +16,7 @@ export const userLogin = async param => {
export const userJoin = async param => {
const res = await api({
url: '/guest',
type: 'post',
type: 'POST',
param,
});
return res;
Expand All @@ -26,7 +26,7 @@ export const userJoin = async param => {
export const userInfoAPI = async param => {
const res = await api({
url: `/guest/${param}`,
type: 'get',
type: 'GET',
param,
});
return res;
Expand All @@ -36,7 +36,7 @@ export const userInfoAPI = async param => {
export const userModify = async param => {
const res = await api({
url: '/modify', // 수정 url 필요
type: 'patch',
type: 'PATCH',
param,
});
return res;
Expand All @@ -46,7 +46,7 @@ export const userModify = async param => {
export const userWaiting = async param => {
const res = await api({
url: `/guest/waiting/${param}`,
type: 'get',
type: 'GET',
param,
});
return res;
Expand Down
9 changes: 1 addition & 8 deletions src/api/api.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,18 @@ Axios.defaults.baseURL = 'http://52.78.74.152';

const api = ({
url,
type = 'get',
type = 'GET',
param,
contentType = 'application/json',
}) => {
const accessToken = sessionStorage.getItem('accessToken');

const headers = {
'Content-Type': contentType,
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH',
'Access-Control-Allow-Headers':
'Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization',
mode: 'cors',
};

if (accessToken !== null) {
headers.Authorization = `Bearer ${accessToken}`;
}

return Axios({
method: type,
url: `${url}`,
Expand Down

0 comments on commit 41fa93a

Please sign in to comment.