temporary backwards compatibility code

This commit is contained in:
Karol Wypchlo 2022-01-13 11:51:23 +01:00
parent 27c033a831
commit e3a25b6ceb
No known key found for this signature in database
GPG Key ID: B515DE9EEBE241E1
3 changed files with 11 additions and 5 deletions

View File

@ -41,8 +41,8 @@ const Navigation = ({ mode, uri }) => {
}, [open]);
const mobileMenuOffset = navRef.current ? navRef.current.offsetTop : 0;
const showLoginNavigation = accounts?.enabled && !accounts?.authenticated;
const showAccountNavigation = accounts?.enabled && accounts?.authenticated;
const showLoginNavigation = accounts && accounts.enabled !== false && !accounts?.authenticated;
const showAccountNavigation = accounts && accounts.enabled !== false && accounts?.authenticated;
return (
<nav

View File

@ -52,8 +52,10 @@ const Uploader = () => {
const [uploads, setUploads] = React.useState([]);
const { data: accounts } = useAccounts();
const showAccountFeatures = accounts?.enabled && !accounts?.auth_required && !accounts?.authenticated;
const disabledComponent = accounts?.enabled && accounts?.auth_required && !accounts?.authenticated;
const showAccountFeatures =
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) => {
setUploads((uploads) => {

View File

@ -1,7 +1,11 @@
import useSWR from "swr";
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() {
return useSWR("/__internal/do/not/use/accounts", fetcher);