Commit 1090e69e authored by Kim, Chaerin's avatar Kim, Chaerin
Browse files

에러해결 및 api 파일 복사

parent 5bc56dd0
const endpoints = {
API_BASE_URL: "http://localhost:8080/api",
ROOM_API: "room",
PROFILE_API: "profile",
};
export default endpoints;
import axios from "axios";
const login = async (payload) => {
const { data } = await axios.post("/api/login", payload);
return data;
};
const signup = async (payload) => {
const { data } = await axios.post("/api/signup", payload);
return data;
};
const profileApi = { login, signup };
export default profileApi;
import axios from "axios";
const login = async (payload) => {
const { data } = await axios.post("/api/login", payload);
return data;
};
const signup = async (payload) => {
const { data } = await axios.post("/api/signup", payload);
return data;
};
const roomApi = { login, signup };
export default roomApi;
import axios from "axios";
import endpoints from "./endpoints";
const login = async (payload) => {
const { data } = await axios.post(`${endpoints.API_BASE_URL}/login`, payload);
console.log(data);
const { data } = await axios.post("/api/login", payload);
return data;
};
const signup = async (payload) => {
const { data } = await axios.post(
`${endpoints.API_BASE_URL}/signup`,
payload
);
const { data } = await axios.post("/api/signup", payload);
return data;
};
......
......@@ -7,7 +7,7 @@ const Header = () => {
className="flex-column align-items-center justify-content-center p-2"
>
<div className="d-flex justify-content-center">
<Link to="/user">
<Link to="/">
<img src="/BORA.png" style={{ width: '160px' }} />
</Link>
</div>
......
import { useEffect, useState } from "react";
import { Redirect } from "react-router-dom";
import login from "../apis/user.api";
import userApi from "../apis/user.api";
const INIT_USER = {
email: "",
password: "",
......@@ -28,7 +28,7 @@ const Login = () => {
try {
// setLoading(true);
// setError("");
const data = await login(user);
const data = await userApi.login(user);
console.log(data);
setSuccess(true);
} catch (error) {
......
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