Fixes here and there

This commit is contained in:
2021-10-13 23:32:09 +02:00
parent 7ffb04961a
commit c45136beb0
3 changed files with 12 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
const apiURL: string = process.env.NODE_ENV === 'development'
// Define API URL from environment
export const API_URL = import.meta.env.MODE === 'development'
? `${import.meta.env.VITE_API_URL_DEV}`
: `${import.meta.env.VITE_API_URL_PROD}`
@@ -8,7 +9,7 @@ const apiURL: string = process.env.NODE_ENV === 'development'
*/
export const fetchAPI = async (query: string) => {
try {
const res = await fetch(`${apiURL}${import.meta.env.VITE_API_GRAPHQL_PATH}`, {
const res = await fetch(`${API_URL}${import.meta.env.VITE_API_GRAPHQL_PATH}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',