temporary backwards compatibility code
This commit is contained in:
parent
27c033a831
commit
e3a25b6ceb
|
@ -41,8 +41,8 @@ const Navigation = ({ mode, uri }) => {
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
const mobileMenuOffset = navRef.current ? navRef.current.offsetTop : 0;
|
const mobileMenuOffset = navRef.current ? navRef.current.offsetTop : 0;
|
||||||
const showLoginNavigation = accounts?.enabled && !accounts?.authenticated;
|
const showLoginNavigation = accounts && accounts.enabled !== false && !accounts?.authenticated;
|
||||||
const showAccountNavigation = accounts?.enabled && accounts?.authenticated;
|
const showAccountNavigation = accounts && accounts.enabled !== false && accounts?.authenticated;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav
|
<nav
|
||||||
|
|
|
@ -52,8 +52,10 @@ const Uploader = () => {
|
||||||
const [uploads, setUploads] = React.useState([]);
|
const [uploads, setUploads] = React.useState([]);
|
||||||
|
|
||||||
const { data: accounts } = useAccounts();
|
const { data: accounts } = useAccounts();
|
||||||
const showAccountFeatures = accounts?.enabled && !accounts?.auth_required && !accounts?.authenticated;
|
const showAccountFeatures =
|
||||||
const disabledComponent = accounts?.enabled && accounts?.auth_required && !accounts?.authenticated;
|
accounts && accounts.enabled !== false && !accounts?.auth_required && !accounts?.authenticated;
|
||||||
|
const disabledComponent =
|
||||||
|
accounts && accounts.enabled !== false && accounts?.auth_required && !accounts?.authenticated;
|
||||||
|
|
||||||
const onUploadStateChange = React.useCallback((id, state) => {
|
const onUploadStateChange = React.useCallback((id, state) => {
|
||||||
setUploads((uploads) => {
|
setUploads((uploads) => {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
const prefix = process.env.GATSBY_API_URL ?? "";
|
const prefix = process.env.GATSBY_API_URL ?? "";
|
||||||
const fetcher = (url) => fetch(`${prefix}${url}`).then((response) => response.json());
|
const fetcher = (url) =>
|
||||||
|
fetch(`${prefix}${url}`)
|
||||||
|
.then((response) => response.json())
|
||||||
|
// temporary backwards compatibility code until new nginx code is deployed
|
||||||
|
.catch((error) => console.log(error) || fetcher(url.replace("/accounts", "/authenticated")));
|
||||||
|
|
||||||
export default function useAccounts() {
|
export default function useAccounts() {
|
||||||
return useSWR("/__internal/do/not/use/accounts", fetcher);
|
return useSWR("/__internal/do/not/use/accounts", fetcher);
|
||||||
|
|
Reference in New Issue