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>
<div class="container">
<div class="form">
<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={() => {
<form class="form" on:submit={()=>{
loading = true
createRoom({ name }, !$isAuth ? pseudo : null).then((r) => {
@ -35,7 +28,16 @@
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}
<span class="spinner"></span>
@ -44,7 +46,7 @@
{/if}
</button>
</div>
</form>
</div>
<style lang="scss">

View File

@ -10,7 +10,7 @@
<div class="form">
<h1>Rejoindre une salle</h1>
<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
</button>
</div>