[F] Fix AquaNet ghost card detection

pull/30/head
Azalea 2024-04-21 14:53:50 -04:00
parent 7b143dd38f
commit f0bfa96937
2 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ export interface Card {
registerTime: string registerTime: string
accessTime: string accessTime: string
linked: boolean linked: boolean
ghost: boolean isGhost: boolean
} }
export interface AquaNetUser { export interface AquaNetUser {

View File

@ -23,7 +23,7 @@
CARD.summary(m.ghostCard.luid).then(s => accountCardSummary = s.summary) CARD.summary(m.ghostCard.luid).then(s => accountCardSummary = s.summary)
// Always put the ghost card at the top // Always put the ghost card at the top
m.cards.sort((a, b) => a.ghost ? -1 : 1) m.cards.sort((a, b) => a.isGhost ? -1 : 1)
state = "ready" state = "ready"
}).catch(e => error = e.message) }).catch(e => error = e.message)
updateMe() updateMe()
@ -54,7 +54,7 @@
console.log("linking card", id) console.log("linking card", id)
// Check if this card is already linked in the account // Check if this card is already linked in the account
if (me?.cards?.some(c => formatLUID(c.luid, c.ghost).toLowerCase() === id.toLowerCase())) { if (me?.cards?.some(c => formatLUID(c.luid, c.isGhost).toLowerCase() === id.toLowerCase())) {
setError("This card is already linked to your account", type) setError("This card is already linked to your account", type)
state = "ready" state = "ready"
return return
@ -217,13 +217,13 @@
{#if me} {#if me}
<div class="existing-cards" transition:slide> <div class="existing-cards" transition:slide>
{#each me.cards as card (card.luid)} {#each me.cards as card (card.luid)}
<div class:ghost={card.ghost} class='existing card' transition:fade|global> <div class:ghost={card.isGhost} class='existing card' transition:fade|global>
<span class="type">{card.ghost ? "Account Card" : cardType(card.luid)}</span> <span class="type">{card.isGhost ? "Account Card" : cardType(card.luid)}</span>
<span class="register">Registered: {moment(card.registerTime).format("YYYY MMM DD")}</span> <span class="register">Registered: {moment(card.registerTime).format("YYYY MMM DD")}</span>
<span class="last">Last used: {moment(card.accessTime).format("YYYY MMM DD")}</span> <span class="last">Last used: {moment(card.accessTime).format("YYYY MMM DD")}</span>
<div/> <div/>
<span class="id">{formatLUID(card.luid, card.ghost)}</span> <span class="id">{formatLUID(card.luid, card.isGhost)}</span>
{#if !card.ghost} {#if !card.isGhost}
<button class="icon error" on:click={() => unlink(card)}><Icon icon="tabler:trash-x-filled"/></button> <button class="icon error" on:click={() => unlink(card)}><Icon icon="tabler:trash-x-filled"/></button>
{/if} {/if}
</div> </div>