mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
33 lines
810 B
JavaScript
33 lines
810 B
JavaScript
|
|
import React from "react";
|
||
|
|
import ReactDOM from "react-dom";
|
||
|
|
import App from "./App";
|
||
|
|
import * as serviceWorker from "./serviceWorker";
|
||
|
|
import { Auth0Provider } from "./react-auth0-spa";
|
||
|
|
import config from "./auth_config.json";
|
||
|
|
import history from "./utils/history";
|
||
|
|
|
||
|
|
// A function that routes the user to the right place
|
||
|
|
// after login
|
||
|
|
const onRedirectCallback = appState => {
|
||
|
|
history.push(
|
||
|
|
appState && appState.targetUrl
|
||
|
|
? appState.targetUrl
|
||
|
|
: window.location.pathname
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
ReactDOM.render(
|
||
|
|
<Auth0Provider
|
||
|
|
domain={config.domain}
|
||
|
|
client_id={config.clientId}
|
||
|
|
redirect_uri={window.location.origin}
|
||
|
|
audience={config.audience}
|
||
|
|
onRedirectCallback={onRedirectCallback}
|
||
|
|
>
|
||
|
|
<App />
|
||
|
|
</Auth0Provider>,
|
||
|
|
document.getElementById("root")
|
||
|
|
);
|
||
|
|
|
||
|
|
serviceWorker.unregister();
|