name validation

This commit is contained in:
Lilian 2023-02-28 12:30:19 +01:00 committed by Kilton937342
parent 0a7d4ff80a
commit 8894bbd78d
2 changed files with 14 additions and 12 deletions

View File

@ -12,15 +12,8 @@
</script> </script>
<div class="container"> <div class="container">
<div class="form"> <form class="form" on:submit={()=>{
<h1>Créer une salle</h1>
<InputWithLabel label="Nom de la salle" bind:value={name} />
{#if !$isAuth}
<InputWithLabel label="Votre pseudo" bind:value={pseudo} />
{/if}
<button
class="primary-btn"
on:click={() => {
loading = true loading = true
createRoom({ name }, !$isAuth ? pseudo : null).then((r) => { createRoom({ name }, !$isAuth ? pseudo : null).then((r) => {
@ -35,7 +28,16 @@
loading= false loading= false
}); });
}}
}}>
<h1>Créer une salle</h1>
<InputWithLabel label="Nom de la salle" bind:value={name} min="3" max="20" />
{#if !$isAuth}
<InputWithLabel label="Votre pseudo" bind:value={pseudo} min="4" max="15" />
{/if}
<button
class="primary-btn"
> >
{#if loading} {#if loading}
<span class="spinner"></span> <span class="spinner"></span>
@ -44,7 +46,7 @@
{/if} {/if}
</button> </button>
</div> </form>
</div> </div>
<style lang="scss"> <style lang="scss">

View File

@ -10,7 +10,7 @@
<div class="form"> <div class="form">
<h1>Rejoindre une salle</h1> <h1>Rejoindre une salle</h1>
<InputWithLabel label="Code de la salle" bind:value={room} /> <InputWithLabel label="Code de la salle" bind:value={room} />
<button class="primary-btn" on:click={()=>{goto('/room/' + room)}}> <button class="primary-btn" on:click={()=>{goto('/room/' + room.replace('#', ""))}}>
Rejoindre Rejoindre
</button> </button>
</div> </div>