all repos — caroster @ 1b27f87d317fe2a90cceb3da3943ea4b18ff9676

[Octree] Group carpool to your event https://caroster.io

🐛 Fix Google authentication
Tim Izzo tim@octree.ch
Tue, 30 Aug 2022 12:08:13 +0200
commit

1b27f87d317fe2a90cceb3da3943ea4b18ff9676

parent

b8b40ec1d3f60e5049716774366c12beb60d215e

M backend/config/server.tsbackend/config/server.ts

@@ -3,6 +3,7 @@

export default ({ env }) => ({ host: env("HOST", "0.0.0.0"), port: env.int("PORT", 1337), + url: env("STRAPI_URL", "http://localhost:1337"), app: { keys: env.array("APP_KEYS"), },
M frontend/containers/LoginGoogle/index.jsfrontend/containers/LoginGoogle/index.js

@@ -12,7 +12,7 @@ <CardContent className={classes.content}>

<Button variant="outlined" color="primary" - href="/connect/google" + href="/api/connect/google" startIcon={<img src="/assets/google-icon.svg" alt="Google Login" />} > {t('signin.withGoogle')}
M frontend/hooks/useSettings.tsfrontend/hooks/useSettings.ts

@@ -1,22 +1,12 @@

-import {useEffect} from 'react'; -import {useSettingLazyQuery, SettingQuery} from '../generated/graphql'; +import {useSettingQuery, SettingQuery} from '../generated/graphql'; import useLangStore from '../stores/useLangStore'; const useSettings = () => { const language = useLangStore(s => s.language); - const locale = {FR: 'fr', EN: 'en'}[language]; - const defaulData: SettingQuery = {}; - const [fetchSettings, {data: {setting: {data: {attributes: setting ={}}={}}={}} = defaulData}] = useSettingLazyQuery({ - variables: {locale}, - }); - - useEffect(() => { - fetchSettings(); - }, [locale]); - - return setting; + const {data = defaulData} = useSettingQuery({variables: {locale}}); + return data?.setting?.data?.attributes; }; export default useSettings;
M frontend/next.config.jsfrontend/next.config.js

@@ -8,6 +8,10 @@ {

source: '/graphql', destination: `${STRAPI_URL}/graphql`, }, + { + source: '/api/:slug*', + destination: `${STRAPI_URL}/api/:slug*`, + }, ]; },