mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-04-05 17:33:31 -04:00
device always replaces local localStorage completion with the
authoritative DB record
This commit is contained in:
@@ -186,14 +186,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// For logged-in users on a new device: restore today's game state from the server
|
// For logged-in users on a new device: restore today's game state from the server.
|
||||||
|
// Runs even when isWon is true so that logging in after completing the game on another
|
||||||
|
// device always replaces local localStorage with the authoritative DB record.
|
||||||
let crossDeviceCheckDate = $state<string | null>(null);
|
let crossDeviceCheckDate = $state<string | null>(null);
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (
|
if (
|
||||||
!browser ||
|
!browser ||
|
||||||
!user ||
|
!user ||
|
||||||
!dailyVerse?.date ||
|
!dailyVerse?.date ||
|
||||||
isWon ||
|
|
||||||
crossDeviceCheckDate === dailyVerse.date ||
|
crossDeviceCheckDate === dailyVerse.date ||
|
||||||
!persistence.anonymousId
|
!persistence.anonymousId
|
||||||
)
|
)
|
||||||
@@ -415,6 +416,18 @@
|
|||||||
<DevButtons />
|
<DevButtons />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if user && session}
|
||||||
|
<div class="mt-6 pt-4 border-t border-gray-200 text-center text-xs text-gray-400">
|
||||||
|
Signed in as {[user.firstName, user.lastName].filter(Boolean).join(" ")}{user.email ? ` (${user.email})` : ""}{user.appleId ? " using Apple" : ""}
|
||||||
|
<form method="POST" action="/auth/logout" use:enhance class="inline">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="ml-2 underline hover:text-gray-600 transition-colors cursor-pointer"
|
||||||
|
>Sign out</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user