Skip to content

Commit

Permalink
fix: base url
Browse files Browse the repository at this point in the history
  • Loading branch information
nogorka committed May 14, 2024
1 parent bffdf0f commit 253a324
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/http/helper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
const get_base_url = () => {
let protocol = 'https'
if (import.meta.env.DEV) protocol = 'http'
console.log(import.meta.env)
return `${protocol}://${import.meta.env.VITE_APP_HOST}:${import.meta.env.VITE_APP_PORT}/`
}
const get_base_url = () =>
`http://${import.meta.env.VITE_APP_HOST}:${import.meta.env.VITE_APP_PORT}/`

const post = async (endpoint, body) => {
const url = get_base_url() + endpoint
Expand All @@ -26,7 +22,7 @@ const post = async (endpoint, body) => {
const get = async (endpoint, paramsObj) => {
const params = new URLSearchParams(paramsObj)
const url = new URL(endpoint, get_base_url())
url.search = params.toString();
url.search = params.toString()

const data = await fetch(url, {
method: 'GET',
Expand Down

0 comments on commit 253a324

Please sign in to comment.