View login.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react'; | |
import { useAuth0 } from '../../../auth/auth0'; | |
import { urls } from '../../../routers/urls'; | |
const Login: React.FC = () => { | |
const { loginWithRedirect, loading } = useAuth0(); | |
useEffect(() => { | |
if (!loading) { | |
loginWithRedirect({ appState: urls.orderManagement }); |
View axios-interceptors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Request interceptor for API calls | |
axios.interceptors.request.use( | |
async config => { | |
const token = await getTokenSilently(); | |
config.headers.authorization = `Bearer ${token}`; | |
return config; | |
}, | |
error => { | |
Promise.reject(error); | |
} |
View auth0.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect, useContext, createContext } from 'react'; | |
import createAuth0Client, { | |
getIdTokenClaimsOptions, | |
GetTokenSilentlyOptions, | |
GetTokenWithPopupOptions, | |
IdToken, | |
LogoutOptions, | |
PopupLoginOptions, | |
RedirectLoginOptions, | |
} from '@auth0/auth0-spa-js'; |
View reactComponentAfterOpt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react'; | |
import { Resource, resourceActions } from '@oplog/resource-redux'; | |
import { useSelector, useDispatch } from 'react-redux'; | |
import { ResourceType } from '../../models'; | |
import { StoreState } from '../../models/state'; | |
import { AddressTypeOutputDTO } from '../../services/swagger'; | |
import { useTranslation } from 'react-i18next'; | |
import { useParams } from 'react-router-dom'; | |
export const HelloWorld: React.FC = () => { |
View reactComponentBeforeOpt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Dispatch, useEffect } from 'react'; | |
import { Resource, resourceActions, resourceSelectors } from '@oplog/resource-redux'; | |
import { connect } from 'react-redux'; | |
import { ResourceType } from '../../models'; | |
import { StoreState } from '../../models/state'; | |
import { AddressTypeOutputDTO } from '../../services/swagger'; | |
import { InjectedIntl, injectIntl } from 'react-intl'; | |
import { RouteComponentProps, withRouter } from 'react-router-dom'; | |
interface IHelloWorld { |
View postinstall.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a temporary fix for open issue https://github.com/facebook/create-react-app/issues/9880 | |
const replace = require('replace-in-file'); | |
const fixFormatWebpackMessages = async () => { | |
try { | |
const results = await replace({ | |
files: 'node_modules/react-dev-utils/formatWebpackMessages.js', | |
from: `let lines = message.split('\\n');`, | |
to: `let lines = []; |
View webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const resolve = require('resolve'); | |
const PnpWebpackPlugin = require('pnp-webpack-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); | |
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin'); | |
const TerserPlugin = require('terser-webpack-plugin'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
View webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const resolve = require('resolve'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); | |
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin'); | |
const TerserPlugin = require('terser-webpack-plugin'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const { WebpackManifestPlugin } = require('webpack-manifest-plugin'); |
View webpack-dev-server.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); | |
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware'); | |
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); | |
const paths = require('./paths'); | |
const fs = require('fs'); | |
const host = process.env.HOST || '0.0.0.0'; |
View webpack-dev-server.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); | |
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware'); | |
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); | |
const ignoredFiles = require('react-dev-utils/ignoredFiles'); | |
const paths = require('./paths'); | |
const fs = require('fs'); | |
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; |