refactor: use apiUrl
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useReducer, createContext, useEffect } from 'react';
|
import { useReducer, createContext, useEffect } from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { apiUrl } from "../apiConfig";
|
||||||
|
|
||||||
interface AuthProviderProps {
|
interface AuthProviderProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -65,7 +66,7 @@ const AuthProvider = ({ children }: AuthProviderProps) => {
|
|||||||
if (res.status === 401 && res.config && !res.config.__isRetryRequest) {
|
if (res.status === 401 && res.config && !res.config.__isRetryRequest) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.get('http://localhost:8080/auth/logout')
|
.get(`${apiUrl}/auth/logout`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('/401 error > logout');
|
console.log('/401 error > logout');
|
||||||
dispatch({ type: 'LOGOUT' });
|
dispatch({ type: 'LOGOUT' });
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
||||||
import { io, Socket } from 'socket.io-client';
|
import { io, Socket } from 'socket.io-client';
|
||||||
|
import { apiUrl } from "../apiConfig";
|
||||||
|
|
||||||
const SERVER_ENDPOINT = 'http://localhost:8080';
|
const SERVER_ENDPOINT = apiUrl;
|
||||||
|
|
||||||
interface SocketState {
|
interface SocketState {
|
||||||
socket: Socket | null;
|
socket: Socket | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user