Commit 1cfd8a38 authored by Kim, Subin's avatar Kim, Subin
Browse files

baseUrl 적용

parent d699f7dd
import axios from "axios"; import axios from "axios";
import baseUrl from "../utils/baseUrl.js";
const signup = async (user) => { const signup = async (user) => {
const url = `/api/auth/signup`; const url = `${baseUrl}/api/auth/signup`;
const { data, status } = await axios.post(url, user); const { data, status } = await axios.post(url, user);
return { data, status } return { data, status }
} }
const login = async (user) => { const login = async (user) => {
const url = `/api/auth/login`; const url = `${baseUrl}/api/auth/login`;
const { data, status } = await axios.post(url, user); const { data, status } = await axios.post(url, user);
return { data, status } return { data, status }
} }
const authApi = { const authApi = {
signup, signup,
login login
}; };
......
import axios from "axios"; import axios from "axios";
import baseUrl from "../utils/baseUrl.js";
const addsubject = async (info) => { const addsubject = async (info) => {
console.log('info확인', info) console.log('info확인', info)
const url = `/api/subject/addsubject`; const url = `${baseUrl}/api/subject/addsubject`;
const { data, status } = await axios.post(url, info); const { data, status } = await axios.post(url, info);
console.log('data status', data, '|', status) console.log('data status', data, '|', status)
return { data, status } return { data, status }
} }
const subjectApi = { const subjectApi = {
addsubject addsubject
}; };
......
import clientConfig from './clientConfig'
const baseUrl = process.env.NODE_ENV === 'production'
? `http://localhost:3001/${clientConfig.serverRoot}`
: ""
export default baseUrl
\ No newline at end of file
const config = {
env: process.env.NODE_ENV === 'production' ? 'production' : 'development',
serverRoot: '/',
loginUser: 'todayKU-user',
}
export default config
\ No newline at end of file
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