blackbirdchess-client-web/src/routes/login/+page.svelte

50 lines
1.2 KiB
Svelte
Raw Normal View History

2023-03-18 18:07:38 +01:00
<div class="container h-full mx-auto flex justify-center items-center flex-col">
<h1 class="my-3">Blackbird Chess</h1>
{#if message.visible}
<aside class="alert variant-filled-error">
<!-- Icon -->
<div><i class="text-2xl icon icon-exclamation-triangle"></i></div>
<!-- Message -->
<p class="alert-message">{message.text}</p>
<!-- Actions -->
<div class="alert-actions">
<i on:click={closeWarning} class="icon icon-close"></i>
</div>
</aside>
{/if}
2023-03-19 10:33:34 +01:00
<Server on:message={showMessage}/>
2023-03-18 18:07:38 +01:00
</div>
<style lang="scss">
</style>
<script lang="js">
2023-03-19 10:33:34 +01:00
import { urls, serverurl } from "../../stores.js";
import login from './Login.svelte'
import Server from './Server.svelte'
2023-03-18 18:07:38 +01:00
let message = {
visible: false,
text: '',
class: 'error'
};
2023-03-19 10:33:34 +01:00
var myserver
2023-03-18 18:07:38 +01:00
2023-03-19 10:33:34 +01:00
serverurl.subscribe(value => {
myserver = value;
2023-03-18 18:07:38 +01:00
});
2023-03-19 10:33:34 +01:00
function closeWarning() {
message.visible = false;
2023-03-18 18:07:38 +01:00
}
2023-03-19 10:33:34 +01:00
function showMessage(error) {
2023-03-18 18:07:38 +01:00
console.log(error);
2023-03-19 10:33:34 +01:00
message.text = error.detail.text;
2023-03-18 18:07:38 +01:00
message.class = 'error'
message.visible = true;
}
</script>