feat: add demo account button on onboarding

This commit is contained in:
Ahmed Bouhuolia
2024-08-20 22:01:36 +02:00
parent 3f23038227
commit 3200d65d90
6 changed files with 73 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
import React from 'react';
import { Redirect } from 'react-router-dom';
import { Config } from '@/config';
interface EnsureOneClickDemoAccountEnabledProps {
children: React.ReactNode;
redirectTo?: string;
}
export const EnsureOneClickDemoAccountEnabled = ({
children,
redirectTo = '/',
}: EnsureOneClickDemoAccountEnabledProps) => {
const enabeld = Config.oneClickDemo.enable || false;
if (!enabeld) {
return <Redirect to={{ pathname: redirectTo }} />;
}
return <>{children}</>;
};