Skip to content

Commit eafd122

Browse files
committed
base url updated
1 parent aaeaf34 commit eafd122

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

src/components/NavBar.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ import {
4242

4343
// Pure functions
4444
import downloadFileUtil from "../controllers/downloadAsFile";
45+
import { BASE_URL } from "../constants";
4546

46-
const URL =
47-
process.env.NODE_ENV == "development"
48-
? "http://localhost:5000/execute/"
49-
: "https://codeditorapi.azurewebsites.net/execute";
47+
const URL = `${BASE_URL}/execute`
5048

5149
const NavBar = ({
5250
code,
@@ -192,11 +190,10 @@ const NavBar = ({
192190
BaseButton: {
193191
style: ({ $theme, $isLoading }) => {
194192
return {
195-
backgroundColor: `${
196-
$isLoading
197-
? $theme.colors.positive200
198-
: $theme.colors.positive300
199-
}`,
193+
backgroundColor: `${$isLoading
194+
? $theme.colors.positive200
195+
: $theme.colors.positive300
196+
}`,
200197
borderTopLeftRadius: `${$theme.borders.radius200} !important`,
201198
borderTopRightRadius: `${$theme.borders.radius200} !important`,
202199
borderBottomLeftRadius: `${$theme.borders.radius200} !important`,

src/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const BASE_URL = process.env.NODE_ENV == "development"
2+
? "http://localhost:5000"
3+
: "https://codeditor-back.vercel.app";

src/controllers/exportHandler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import Axios from "axios";
2+
import { BASE_URL } from "../constants";
23

3-
const URL =
4-
process.env.NODE_ENV == "development"
5-
? `http://localhost:5000/share/export`
6-
: `https://codeditorapi.azurewebsites.net/share/export`;
4+
const URL = `${BASE_URL}/share/export`;
75

86
const exportHandler = (code, language, input, expire, setIsLoading, setId) => {
97
// console.log({

src/controllers/importHandler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import Axios from "axios";
2+
import { BASE_URL } from "../constants";
23

3-
const URL =
4-
process.env.NODE_ENV == "development"
5-
? `http://localhost:5000/share/import`
6-
: `https://codeditorapi.azurewebsites.net/share/import`;
4+
const URL = `${BASE_URL}/share/import`;
75

86
const importHandler = (
97
id,

0 commit comments

Comments
 (0)