refactor: use apiUrl
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
|||||||
CircularProgress,
|
CircularProgress,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { useGlobalInfoStore } from "../context/globalInfo";
|
import { useGlobalInfoStore } from "../context/globalInfo";
|
||||||
|
import { apiUrl } from "../apiConfig";
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
@@ -40,7 +41,7 @@ const Login = () => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.post(`http://localhost:8080/auth/login`, { email, password });
|
const { data } = await axios.post(`${apiUrl}/auth/login`, { email, password });
|
||||||
dispatch({ type: 'LOGIN', payload: data });
|
dispatch({ type: 'LOGIN', payload: data });
|
||||||
notify('success', 'Welcome to Maxun!');
|
notify('success', 'Welcome to Maxun!');
|
||||||
window.localStorage.setItem('user', JSON.stringify(data));
|
window.localStorage.setItem('user', JSON.stringify(data));
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { RunSettings } from "../components/molecules/RunSettings";
|
|||||||
import { ScheduleSettings } from "../components/molecules/ScheduleSettings";
|
import { ScheduleSettings } from "../components/molecules/ScheduleSettings";
|
||||||
import { IntegrationSettings } from "../components/molecules/IntegrationSettings";
|
import { IntegrationSettings } from "../components/molecules/IntegrationSettings";
|
||||||
import { RobotSettings } from "../components/molecules/RobotSettings";
|
import { RobotSettings } from "../components/molecules/RobotSettings";
|
||||||
|
import { apiUrl } from "../apiConfig";
|
||||||
|
|
||||||
interface MainPageProps {
|
interface MainPageProps {
|
||||||
handleEditRecording: (id: string, fileName: string) => void;
|
handleEditRecording: (id: string, fileName: string) => void;
|
||||||
@@ -88,7 +89,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => {
|
|||||||
createRunForStoredRecording(runningRecordingId, settings).then(({ browserId, runId }: CreateRunResponse) => {
|
createRunForStoredRecording(runningRecordingId, settings).then(({ browserId, runId }: CreateRunResponse) => {
|
||||||
setIds({ browserId, runId });
|
setIds({ browserId, runId });
|
||||||
const socket =
|
const socket =
|
||||||
io(`http://localhost:8080/${browserId}`, {
|
io(`${apiUrl}/${browserId}`, {
|
||||||
transports: ["websocket"],
|
transports: ["websocket"],
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import axios from 'axios';
|
|||||||
import { AuthContext } from '../context/auth';
|
import { AuthContext } from '../context/auth';
|
||||||
import { TextField, Button, CircularProgress, Typography, Box, Container } from '@mui/material';
|
import { TextField, Button, CircularProgress, Typography, Box, Container } from '@mui/material';
|
||||||
import { useGlobalInfoStore } from "../context/globalInfo";
|
import { useGlobalInfoStore } from "../context/globalInfo";
|
||||||
|
import { apiUrl } from "../apiConfig";
|
||||||
|
|
||||||
const Register = () => {
|
const Register = () => {
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
@@ -31,7 +32,7 @@ const Register = () => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.post('http://localhost:8080/auth/register', {
|
const { data } = await axios.post(`${apiUrl}/auth/register`, {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user