Ajoute les redirections coté front
Vu qu'on utilise un serviceworker, lorsque la requête ne passe pas jusqu'au serveur, la redirection n'est pas effective On parse les règles de redirection netlify coté front et on les ajoute à l'apppull/640/head
parent
f958e632d5
commit
f2ba57eca8
|
@ -158,6 +158,7 @@
|
|||
"source-map-support": "^0.5.4",
|
||||
"style-loader": "^0.23.1",
|
||||
"styled-components": "^4.2.0",
|
||||
"toml-loader": "^1.0.0",
|
||||
"url-loader": "^1.0.1",
|
||||
"webpack": "^4.39.3",
|
||||
"webpack-cli": "^3.1.2",
|
||||
|
|
|
@ -8,7 +8,7 @@ import Raven from 'raven-js'
|
|||
import React, { useEffect } from 'react'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Route, Switch } from 'react-router-dom'
|
||||
import { Redirect, Route, Switch } from 'react-router-dom'
|
||||
import 'Ui/index.css'
|
||||
import Provider from '../../Provider'
|
||||
import { persistEverything, retrievePersistedState } from '../../storage/persistEverything'
|
||||
|
@ -31,6 +31,7 @@ import Integration from './pages/integration/index'
|
|||
import Landing from './pages/Landing/Landing.js'
|
||||
import Simulateurs from './pages/Simulateurs'
|
||||
import ÉconomieCollaborative from './pages/ÉconomieCollaborative'
|
||||
import redirects from './redirects'
|
||||
import { constructLocalizedSitePath } from './sitePaths'
|
||||
|
||||
|
||||
|
@ -101,6 +102,8 @@ const App = compose(withSitePaths)(({ sitePaths }) => {
|
|||
<div className="app-content">
|
||||
<div className="ui__ container" style={{ flexGrow: 1, flexShrink: 0 }}>
|
||||
<Switch>
|
||||
{redirects}
|
||||
<Redirect from="/zoub/*" to="/zab/*" />
|
||||
<Route path={sitePaths.créer.index} component={Créer} />
|
||||
<Route
|
||||
path={sitePaths.gérer.index}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import React from 'react';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
import netlifyToml from '../../../netlify.toml';
|
||||
|
||||
export default netlifyToml.redirects
|
||||
.filter(({ from, status }) => status === 301 && !from.startsWith('https'))
|
||||
.map(x => console.log(x) || x)
|
||||
.map(({ from, to }) =>
|
||||
<Redirect key={from} from={decodeURIComponent(from)} to={decodeURIComponent(to.replace(':splat', '*'))} exact />
|
||||
)
|
|
@ -117,7 +117,10 @@ module.exports.commonLoaders = ({ legacy = false } = {}) => {
|
|||
test: /\.yaml$/,
|
||||
use: ['json-loader', 'yaml-loader']
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.toml$/,
|
||||
use: ['toml-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ne$/,
|
||||
use: [babelLoader, 'nearley-loader']
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -10803,6 +10803,18 @@ toidentifier@1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
|
||||
integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
|
||||
|
||||
toml-loader@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/toml-loader/-/toml-loader-1.0.0.tgz#05249b9294b623601148260caa480b22a653a19a"
|
||||
integrity sha1-BSSbkpS2I2ARSCYMqkgLIqZToZo=
|
||||
dependencies:
|
||||
toml "^2.2.2"
|
||||
|
||||
toml@^2.2.2:
|
||||
version "2.3.6"
|
||||
resolved "https://registry.yarnpkg.com/toml/-/toml-2.3.6.tgz#25b0866483a9722474895559088b436fd11f861b"
|
||||
integrity sha512-gVweAectJU3ebq//Ferr2JUY4WKSDe5N+z0FvjDncLGyHmIDoxgY/2Ie4qfEIDm4IS7OA6Rmdm7pdEEdMcV/xQ==
|
||||
|
||||
topo@2.x.x:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182"
|
||||
|
|
Loading…
Reference in New Issue