Use PENDING for unpaid invoices

This commit is contained in:
ekzyis 2023-12-02 21:47:20 +01:00
parent c885efe034
commit 7a913d0f27
2 changed files with 3 additions and 3 deletions

View File

@ -80,7 +80,7 @@ func (db *DB) FetchUserInvoices(pubkey string, invoices *[]Invoice) error {
var (
query = "" +
"SELECT id, pubkey, msats, preimage, hash, bolt11, created_at, expires_at, confirmed_at, held_since, COALESCE(description, ''), " +
"CASE WHEN confirmed_at IS NOT NULL THEN 'PAID' WHEN expires_at < CURRENT_TIMESTAMP THEN 'EXPIRED' ELSE 'WAITING' END AS status " +
"CASE WHEN confirmed_at IS NOT NULL THEN 'PAID' WHEN expires_at < CURRENT_TIMESTAMP THEN 'EXPIRED' ELSE 'PENDING' END AS status " +
"FROM invoices " +
"WHERE pubkey = $1 " +
"ORDER BY created_at DESC"

View File

@ -9,7 +9,7 @@
<th>details</th>
</thead>
<tbody>
<tr v-for="i in invoices" :key="i.id">
<tr v-for="i in invoices" :key="i.id">
<td>{{ i.Msats / 1000 }}</td>
<td :title="i.CreatedAt">{{ ago(new Date(i.CreatedAt)) }}</td>
<td :title="i.ExpiresAt" class="hidden-sm">{{ ago(new Date(i.ExpiresAt)) }}</td>
@ -27,7 +27,7 @@
import { ref } from 'vue'
import ago from 's-ago'
const classFromStatus = (status) => status === 'PAID' ? 'success' : 'error'
const classFromStatus = (status) => status === 'PAID' ? 'success' : status === 'PENDING' ? 'info' : 'error'
const invoices = ref(null)