aboutsummaryrefslogtreecommitdiffstats
path: root/docker/postgres.Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'docker/postgres.Dockerfile')
0 files changed, 0 insertions, 0 deletions
tr-tools&id=cf29dcc02e2c9ac593d6e8f0aff2589b80ffa994'>tree)
1
2
3
4
5
6
7
8
9
                               
                                 



                                                      
 

                                                         
                                           
                                  
 
                                                                               
                                                                                                 
 
                                                         
 
                                             
 
import Qr from 'qrcode-base64';
import { get } from '$lib/utils';
import { redirect } from '@sveltejs/kit';

export async function load({ depends, params, url }) {
	depends('app:invoice');

	let { hash } = params;
	let invoice = await get(`/invoice?hash=${hash}`);
	let { amount, received } = invoice;
	amount = parseInt(amount);

	let paid = (!amount && received) || (amount > 0 && received >= amount);
	if (paid && !url.pathname.endsWith('paid')) throw redirect(307, `/invoice/${hash}/paid`);

	let sm = Qr.drawImg(invoice.text, { size: 300 });

	return { hash, invoice, sm, lg: sm };
}