🐛 Fix Google authentication
Tim Izzo tim@octree.ch
Tue, 30 Aug 2022 12:08:13 +0200
4 files changed,
9 insertions(+),
14 deletions(-)
M
backend/config/server.ts
→
backend/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.js
→
frontend/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.ts
→
frontend/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.js
→
frontend/next.config.js
@@ -8,6 +8,10 @@ {
source: '/graphql', destination: `${STRAPI_URL}/graphql`, }, + { + source: '/api/:slug*', + destination: `${STRAPI_URL}/api/:slug*`, + }, ]; },