add effet loading

This commit is contained in:
AntoninoP 2024-07-03 16:57:55 +02:00
parent 9accc4f279
commit ae09e7b7e4

View File

@ -4,7 +4,7 @@ import { getUserSubdomain } from "../../service/firebase";
import { saveSubdomain } from "../../service/serverService"; import { saveSubdomain } from "../../service/serverService";
const CreateServer = ({ user, onCreateServer }) => { const CreateServer = ({ user, onCreateServer }) => {
const [subdomain, setSubdomain] = useState(null); const [subdomain, setSubdomain] = useState('loading'); // Utiliser 'loading' au lieu de null
const [subdomainInput, setSubdomainInput] = useState(''); const [subdomainInput, setSubdomainInput] = useState('');
const loadSubdomain = async () => { const loadSubdomain = async () => {
@ -33,9 +33,16 @@ const CreateServer = ({ user, onCreateServer }) => {
} }
}; };
if (subdomain === 'loading') {
return (
<div className={styles.container}>
</div>
);
}
return ( return (
<> <>
{subdomain === null ? ( {subdomain === '' ? (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.mainCardSubdomain}> <div className={styles.mainCardSubdomain}>
<div className={styles.Title}>Ecrivez votre sous domaine</div> <div className={styles.Title}>Ecrivez votre sous domaine</div>