diff --git a/website/components/FunctionCard/FunctionCard.js b/website/components/FunctionCard/FunctionCard.js index 2856bce..40169e2 100644 --- a/website/components/FunctionCard/FunctionCard.js +++ b/website/components/FunctionCard/FunctionCard.js @@ -3,7 +3,7 @@ import { useState, forwardRef } from 'react'; import date from 'date-and-time'; import Loader from '../Loader'; import './FunctionCard.css'; -import { API_URL } from '../../utils/config'; +import { API_URL } from '../../utils/config/config'; const FunctionCard = forwardRef((props, ref) => { @@ -13,6 +13,10 @@ const FunctionCard = forwardRef((props, ref) => { setIsLoading(false); } + const handleError = (event) => { + event.target.src = API_URL + "/images/functions/default.png"; + } + const isFormOrArticle = (props.type === 'form' || props.type === 'article'); return ( @@ -37,7 +41,7 @@ const FunctionCard = forwardRef((props, ref) => {
- {props.title} + {props.title}

{props.title}

{props.description}

diff --git a/website/components/FunctionPage/FunctionComponentTop.js b/website/components/FunctionPage/FunctionComponentTop.js index 1282618..2765cf3 100644 --- a/website/components/FunctionPage/FunctionComponentTop.js +++ b/website/components/FunctionPage/FunctionComponentTop.js @@ -6,7 +6,7 @@ import { faStar as farStar } from '@fortawesome/free-regular-svg-icons'; import date from 'date-and-time'; import { UserContext } from '../../contexts/UserContext'; import api from '../../utils/api'; -import { API_URL } from '../../utils/config'; +import { API_URL } from '../../utils/config/config'; import '../FunctionCard/FunctionCard.css'; const FunctionComponentTop = (props) => { @@ -40,6 +40,10 @@ const FunctionComponentTop = (props) => { } } + const handleError = (event) => { + event.target.src = API_URL + "/images/functions/default.png"; + } + return (
@@ -49,7 +53,7 @@ const FunctionComponentTop = (props) => { } - {props.title} + {props.title}

{props.title}

{props.description}

diff --git a/website/components/FunctionPage/FunctionPage.js b/website/components/FunctionPage/FunctionPage.js index a0584ba..21d4a45 100644 --- a/website/components/FunctionPage/FunctionPage.js +++ b/website/components/FunctionPage/FunctionPage.js @@ -1,5 +1,5 @@ import { Fragment, useState } from 'react'; -import { API_URL } from '../../utils/config'; +import { API_URL } from '../../utils/config/config'; import HeadTag from '../HeadTag'; import FunctionTabsTop from './FunctionTabsTop'; import FunctionComponentTop from './FunctionComponentTop'; diff --git a/website/next.config.js b/website/next.config.js index 43e0ba3..c4df49d 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -1,3 +1,3 @@ -const withCSS = require('@zeit/next-css'); +const withCSS = require('@zeit/next-css'); const withFonts = require('next-fonts'); module.exports = withFonts(withCSS()); \ No newline at end of file diff --git a/website/pages/admin/[slug].js b/website/pages/admin/[slug].js index c7ff0b3..261f9c2 100644 --- a/website/pages/admin/[slug].js +++ b/website/pages/admin/[slug].js @@ -7,7 +7,7 @@ import EditArticleFunction from '../../components/FunctionAdmin/EditArticleFunct import EditFormFunction from '../../components/FunctionAdmin/EditFormFunction'; import redirect from '../../utils/redirect'; import api from '../../utils/api'; -import { API_URL } from '../../utils/config'; +import { API_URL } from '../../utils/config/config'; import '../../components/FunctionPage/FunctionTabs.css'; import '../../public/css/pages/admin.css'; diff --git a/website/pages/users/[name].js b/website/pages/users/[name].js index 0d1982f..91796af 100644 --- a/website/pages/users/[name].js +++ b/website/pages/users/[name].js @@ -11,7 +11,7 @@ import redirect from '../../utils/redirect'; import htmlParser from 'html-react-parser'; import Loader from '../../components/Loader'; import api from '../../utils/api'; -import { API_URL } from '../../utils/config'; +import { API_URL } from '../../utils/config/config'; import '../../public/css/pages/profile.css'; const Profile = (props) => { diff --git a/website/utils/api.js b/website/utils/api.js index 81b78c3..323405f 100644 --- a/website/utils/api.js +++ b/website/utils/api.js @@ -1,5 +1,5 @@ import axios from 'axios'; -import { API_URL } from './config'; +import { API_URL } from './config/config'; const api = axios.create({ baseURL: API_URL, diff --git a/website/utils/config.js b/website/utils/config/config.dev.js similarity index 100% rename from website/utils/config.js rename to website/utils/config/config.dev.js diff --git a/website/utils/config/config.js b/website/utils/config/config.js new file mode 100644 index 0000000..f334f3c --- /dev/null +++ b/website/utils/config/config.js @@ -0,0 +1 @@ +export const API_URL = "http://localhost:8080"; \ No newline at end of file diff --git a/website/utils/config/config.prod.js b/website/utils/config/config.prod.js new file mode 100644 index 0000000..c36dbfe --- /dev/null +++ b/website/utils/config/config.prod.js @@ -0,0 +1 @@ +export const API_URL = "https://api.function.divlo.fr"; \ No newline at end of file