Skip to content

Commit

Permalink
Adding server url
Browse files Browse the repository at this point in the history
  • Loading branch information
TangoBeee committed Jan 21, 2024
1 parent fcf2d9e commit 8c4688d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SwiftLinkClient/src/components/Form/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useRef, useState } from 'react'
import URLInput from '../URLInput/URLInput';
import { FormContainer } from './Form.styled';
import Button from '../Button/Button';
import { SERVER_BASE_URL } from '../../constants/config';

const Form = ({ setShowResult, setShortUrl }) => {
const defaultFormButtonText = "Shorten it"
Expand Down Expand Up @@ -38,7 +39,7 @@ const Form = ({ setShowResult, setShortUrl }) => {
}

const callShortURLAPI = async () => {
await fetch(`${import.meta.env.VITE_SERVER_BASE_URL}/url`, {
await fetch(`${SERVER_BASE_URL}/url`, {
method: 'post',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({"url": urlInput})
Expand All @@ -50,7 +51,7 @@ const Form = ({ setShowResult, setShortUrl }) => {
formRef.current.style.pointerEvents = "auto"
formInputRef.current.removeAttribute('disabled')
setShowResult(true)
setShortUrl(`${import.meta.env.VITE_SERVER_BASE_URL}/${resShortID}`)
setShortUrl(`${SERVER_BASE_URL}/${resShortID}`)
} else {
setFormButtonText(defaultFormButtonText)
formRef.current.style.pointerEvents = "auto"
Expand Down
1 change: 1 addition & 0 deletions SwiftLinkClient/src/constants/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const SERVER_BASE_URL = "https://swiftlink-app.onrender.com"

0 comments on commit 8c4688d

Please sign in to comment.