Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#344] API URL 변경 #345

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"react-hook-form": "^7.49.3",
"react-icons": "^4.12.0",
"react-modal": "^3.16.1",
"react-router-dom": "^6.21.1",
"react-router-dom": "^6.22.3",
"react-snap": "^1.23.0",
"react-window": "^1.8.10",
"styled-components": "^6.1.6",
Expand Down
7 changes: 4 additions & 3 deletions src/apis/axiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import {
STATUS_CODE,
} from "@constants/api";
import { PATH } from "@constants/path";
import axios from "axios";

import { fetchNewToken } from "./fetchNewToken";

import type {
AxiosError,
AxiosRequestConfig,
InternalAxiosRequestConfig,
} from "axios";
import axios from "axios";

import { fetchNewToken } from "./fetchNewToken";

export const axiosInstance = axios.create({
baseURL: BASE_URL,
Expand Down
5 changes: 3 additions & 2 deletions src/apis/fetchLogin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BASE_URL, END_POINTS } from "@/constants/api";
import axios from "axios";

import type { EmailValidateData, LoginData } from "@type/login";
import type { ResponseData } from "@type/responseType";
import axios from "axios";

import { BASE_URL, END_POINTS } from "@/constants/api";

interface LoginProps {
email: string;
Expand Down
3 changes: 2 additions & 1 deletion src/constants/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export const BASE_URL = "https://3.35.83.30.nip.io";
export const BASE_URL = "https://43.200.52.7.nip.io";

export const END_POINTS = {
LOGIN: "/v1/members/signin",
LOGOUT: "/v1/members/logout",
SIGNUP: "/v1/members/signup",
ALARM: "/v1/alarms",
PASSWORD: "/v1/members/password",
HASALARM: "/v1/alarms/status",
ROOM: (productId: string) => `/v1/products/${productId}`,
RESERVATION: "/v1/reservations",
Expand Down
3 changes: 1 addition & 2 deletions src/mocks/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export const handlers = [
warning 없애기용.
cdn에 폰트 요청하는걸 가로채지 못했다고 warning 띄우길래 적용했습니다.
*/
http.get("*", (req) => {
console.log(req);
http.get("*", () => {
return;
}),
];
4 changes: 2 additions & 2 deletions src/mocks/handlers/email.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { END_POINTS } from "@constants/api";
import { BASE_URL, END_POINTS } from "@constants/api";
import { http, HttpResponse } from "msw";

export const getEmailVerification = (scenarioProps?: string) => {
return http.post(`https://3.34.147.187.nip.io${END_POINTS.EMAIL}`, () => {
return http.post(`${BASE_URL}${END_POINTS.EMAIL}`, () => {
const pageParams = new URLSearchParams(window.location.search);
const scenario = pageParams.get("scenario");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useNavigate } from "react-router-dom";

import * as S from "../../PasswordReset.style";

import { BASE_URL, END_POINTS } from "@/constants/api";

const PasswordResetSubmitBtn = () => {
const navigate = useNavigate();
const {
Expand All @@ -15,7 +17,7 @@ const PasswordResetSubmitBtn = () => {
const handleOnSubmit = async () => {
const data = getValues(["email", "password"]);
await axios
.patch("https://3.34.147.187.nip.io/v1/members/password", {
.patch(`${BASE_URL}${END_POINTS.PASSWORD}`, {
email: data[0],
password: data[1],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useNavigate } from "react-router-dom";

import * as S from "../../SignUp.style";

import { BASE_URL, END_POINTS } from "@/constants/api";

const SignUpSubmitBtn = () => {
const navigate = useNavigate();

Expand All @@ -23,7 +25,7 @@ const SignUpSubmitBtn = () => {
"term2",
]);
await axios
.post("https://3.34.147.187.nip.io/v1/members/signup", {
.post(`${BASE_URL}${END_POINTS.SIGNUP}`, {
email: data[0],
password: data[1],
name: data[2],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const Input = styled(motion.input)`
box-shadow: 4px 4px 10px 0 rgba(0, 0, 0, 0.04);

text-align: center;
/* padding-right: 40px; */
transition: 0.2s;

&::placeholder {
Expand Down
4 changes: 3 additions & 1 deletion tests/e2eTests/models/SignupPage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Page } from "@playwright/test";

import { BASE_URL, END_POINTS } from "@/constants/api";

export class Signup {
page: Page;

Expand Down Expand Up @@ -56,7 +58,7 @@ export class Signup {

const response = await this.page.waitForResponse(
(response) =>
response.url() === "https://3.34.147.187.nip.io/v1/members/email" &&
response.url() === `${BASE_URL}${END_POINTS.EMAIL}` &&
response.status() === 200,
);

Expand Down
Loading