Appearance
Get Assets Page ​
File Information ​
- Path:
app/pages/get_assets.vue - Route:
/get_assets - Purpose: Server-side asset download redirect page
- Layout: None (redirects immediately)
- Middleware: None (handles download internally)
Overview ​
The Get Assets page is a server-side redirect page that handles authenticated asset downloads. It receives download parameters via query string, calls the download API, and redirects the user to the actual download URL. This page runs only on the server-side during SSR.
Key Features ​
Server-Side Processing
- Runs only on server (SSR)
- Processes download request
- Redirects to download URL
Query Parameter Handling
- Reads query parameters from URL
- Builds download API endpoint
- Forwards authentication cookies
Download API Integration
- Calls download API endpoint
- Gets redirect URL from response
- Handles API errors
Error Handling
- Handles API errors
- Shows Nuxt error page on failure
- Proper error status codes
Components Used ​
None - page redirects immediately, no template content.
Composables Used ​
useNuxtApp()- Nuxt app instanceuseRoute()- Route accessuseRequestHeaders()- Request headers access
Data Properties ​
None - page uses route query parameters directly.
Methods ​
callOnce (Server-Side) ​
Runs download logic once on server-side.
typescript
await callOnce(async () => {
const { $api } = useNuxtApp()
try {
// Build query string from route query
const qs = new URLSearchParams(useRoute().query as any).toString()
const downloadUrl = `digital/object-download?${qs}`
// Call download API with authentication
const redirectUrl: string = await $api(downloadUrl, {
headers: useRequestHeaders(['cookie']), // Forward cookies
})
// Redirect to download URL
await navigateTo(redirectUrl, { external: true })
} catch (err: any) {
// Show Nuxt error page
throw createError({
statusCode: err.statusCode || err.response?.status || 500,
statusMessage: err.statusMessage || err.response?.data?.message || err.message,
})
}
})Flow:
- Builds query string from route query parameters
- Constructs download API endpoint
- Calls API with authentication cookies
- Gets redirect URL from response
- Redirects to external download URL
- Handles errors with proper status codes
User Interactions ​
None - page redirects immediately, no user interaction.
Styling ​
None - page has empty template, redirects immediately.
Lifecycle Hooks ​
callOnce (Server-Side) ​
Runs download logic during SSR.
typescript
await callOnce(async () => {
// Download logic runs here
})Purpose: Ensures download logic runs only once on server-side.
API Endpoints ​
Download Asset ​
- Endpoint:
GET /digital/object-download(via$api()) - Query Parameters: Various download parameters (asset IDs, format, etc.)
- Headers:typescript
{ cookie: string // Authentication cookies } - Response: Redirect URL (string)
User Flow ​
- User clicks download link (e.g.,
/get_assets?asset_id=123&format=jpg) - Page loads on server-side
- System builds download API endpoint from query parameters
- System calls download API with authentication
- System receives redirect URL from API
- System redirects user to download URL (external)
- User's browser downloads the file
- On error:
- Nuxt error page displayed
- Proper error status code shown
Security Considerations ​
- Authentication cookies forwarded to API
- Server-side processing prevents client-side manipulation
- Query parameters validated by API
- External redirect to secure download URL
Notes for Development ​
- Page runs only on server-side (SSR)
- Uses
callOnceto ensure single execution - Query parameters passed to download API
- Authentication cookies forwarded via headers
- External redirect to download URL
- Error handling shows Nuxt error page
- Empty template (redirects immediately)
- No client-side JavaScript needed
Related Documentation ​
- Download Store - Download state management
- Server APIs | Composable APIs - API documentation