|
@@ -7,6 +7,7 @@
|
|
|
let isAuthenticated = false;
|
|
let isAuthenticated = false;
|
|
|
let isLoading = true;
|
|
let isLoading = true;
|
|
|
let user = null;
|
|
let user = null;
|
|
|
|
|
+ let currency = 'USD';
|
|
|
|
|
|
|
|
$: authentication.subscribe((value) => {
|
|
$: authentication.subscribe((value) => {
|
|
|
isAuthenticated = !!value;
|
|
isAuthenticated = !!value;
|
|
@@ -21,7 +22,14 @@
|
|
|
if (storedAuth) {
|
|
if (storedAuth) {
|
|
|
authentication.set(JSON.parse(storedAuth));
|
|
authentication.set(JSON.parse(storedAuth));
|
|
|
} else {
|
|
} else {
|
|
|
- goto('/login');
|
|
|
|
|
|
|
+ goto('/logout');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const defaultCurrency = localStorage.getItem('defaultCurrency');
|
|
|
|
|
+ if (defaultCurrency) {
|
|
|
|
|
+ currency = defaultCurrency;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ localStorage.setItem('defaultCurrency', 'USD');
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('Error parsing stored auth:', error);
|
|
console.error('Error parsing stored auth:', error);
|
|
@@ -33,6 +41,12 @@
|
|
|
function logout() {
|
|
function logout() {
|
|
|
window.location.href = '/logout';
|
|
window.location.href = '/logout';
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ function updateCurrency(event) {
|
|
|
|
|
+ currency = event.target.value;
|
|
|
|
|
+ localStorage.setItem('defaultCurrency', currency);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<svelte:head>
|
|
<svelte:head>
|
|
@@ -45,13 +59,48 @@
|
|
|
<p>Loading...</p>
|
|
<p>Loading...</p>
|
|
|
{:else if isAuthenticated}
|
|
{:else if isAuthenticated}
|
|
|
<p>You are logged in as <strong>{user.username}</strong>!</p>
|
|
<p>You are logged in as <strong>{user.username}</strong>!</p>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="button-container">
|
|
|
|
|
+ <select class="form-control order-select" on:change={updateCurrency} value={currency}>
|
|
|
|
|
+ <option value="BRL">BRL</option>
|
|
|
|
|
+ <option value="EUR">EUR</option>
|
|
|
|
|
+ <option value="USD" selected>USD</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="button-container">
|
|
|
|
|
+ <select class="form-control order-select">
|
|
|
|
|
+ <option value="light">Light</option>
|
|
|
|
|
+ <!-- <option value="dark">Dark</option>-->
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<button class="logout-button" on:click={logout}>Logout</button>
|
|
<button class="logout-button" on:click={logout}>Logout</button>
|
|
|
{/if}
|
|
{/if}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
<style>
|
|
|
- input::placeholder {
|
|
|
|
|
- opacity: 0.5;
|
|
|
|
|
|
|
+ .button-container {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+ margin-bottom: 1rem;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .order-select {
|
|
|
|
|
+ width: 200px;
|
|
|
|
|
+ padding: 0.5rem;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ border: 1px solid #ddd;
|
|
|
|
|
+ font-size: 1rem;
|
|
|
|
|
+ background-color: #f9f9f9;
|
|
|
|
|
+ transition: border-color 0.3s ease;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .order-select:focus {
|
|
|
|
|
+ border-color: #2980b9;
|
|
|
|
|
+ outline: none;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.logout-button {
|
|
.logout-button {
|