File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed
src/routes/(console)/organization-[organization] Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 23
23
import { toLocaleDate } from ' $lib/helpers/date' ;
24
24
import { formatCurrency } from ' $lib/helpers/numbers' ;
25
25
import type { Invoice , InvoiceList } from ' $lib/sdk/billing' ;
26
- import { getApiEndpoint , sdk } from ' $lib/stores/sdk' ;
26
+ import { sdk } from ' $lib/stores/sdk' ;
27
27
import { Query } from ' @appwrite.io/console' ;
28
28
import { onMount } from ' svelte' ;
29
29
import { trackEvent } from ' $lib/actions/analytics' ;
30
30
import { selectedInvoice , showRetryModal } from ' ./store' ;
31
31
import { organization } from ' $lib/stores/organization' ;
32
+ import { base } from ' $app/paths' ;
32
33
33
34
let showDropdown = [];
34
35
let showFailedError = false ;
41
42
};
42
43
43
44
const limit = 5 ;
44
- const endpoint = getApiEndpoint ();
45
45
46
46
onMount (request );
47
47
153
153
<DropListLink
154
154
icon =" external-link"
155
155
external
156
- href ={` ${endpoint }/organizations/ ${$page .params .organization }/invoices/${invoice .$id }/view ` }
156
+ href ={` ${base }/organization- ${$page .params .organization }/invoices/${invoice .$id }/view ` }
157
157
on:click ={() => (showDropdown [i ] = ! showDropdown [i ])}
158
158
event =" view_invoice" >
159
159
View invoice
160
160
</DropListLink >
161
161
<DropListLink
162
162
icon =" download"
163
- href ={` ${endpoint }/organizations/ ${$page .params .organization }/invoices/${invoice .$id }/download ` }
163
+ href ={` ${base }/organization- ${$page .params .organization }/invoices/${invoice .$id }/download ` }
164
164
on:click ={() => {
165
165
showDropdown [i ] = ! showDropdown [i ];
166
166
}}
Original file line number Diff line number Diff line change
1
+ import { getApiEndpoint , sdk } from '$lib/stores/sdk' ;
2
+ import { redirect } from '@sveltejs/kit' ;
3
+ import type { PageLoad } from './$types' ;
4
+
5
+ export const load : PageLoad = async ( { params } ) => {
6
+ // verify invoice exists
7
+ const invoice = await sdk . forConsole . billing . getInvoice ( params . organization , params . invoiceId ) ;
8
+ const endpoint = getApiEndpoint ( ) ;
9
+
10
+ return redirect (
11
+ 302 ,
12
+ `${ endpoint } /organizations/${ params . organization } /invoices/${ invoice . $id } /download`
13
+ ) ;
14
+ } ;
Original file line number Diff line number Diff line change
1
+ import { getApiEndpoint , sdk } from '$lib/stores/sdk' ;
2
+ import { redirect } from '@sveltejs/kit' ;
3
+ import type { PageLoad } from './$types' ;
4
+
5
+ export const load : PageLoad = async ( { params } ) => {
6
+ // verify invoice exists
7
+ const invoice = await sdk . forConsole . billing . getInvoice ( params . organization , params . invoiceId ) ;
8
+ const endpoint = getApiEndpoint ( ) ;
9
+
10
+ return redirect (
11
+ 302 ,
12
+ `${ endpoint } /organizations/${ params . organization } /invoices/${ invoice . $id } /view`
13
+ ) ;
14
+ } ;
You can’t perform that action at this time.
0 commit comments