-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small fixes for company names in new page
- Loading branch information
Showing
4 changed files
with
19 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 15 additions & 34 deletions
49
.../(categorical)/companies/[domain]/app-adstxt/publisher/[publisher_id]/download/+server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,19 @@ | ||
// src/routes/mypath/download/+server.ts | ||
import type { RequestHandler } from '@sveltejs/kit'; | ||
|
||
|
||
|
||
async function getPublishersApps(companyDomain: string, publisher_id: string) { | ||
const publishers_apps = fetch( | ||
`http://localhost:8000/api/companies/${companyDomain}/adstxt/publisher/${publisher_id}/download` | ||
); | ||
return publishers_apps; | ||
} | ||
|
||
|
||
const generateCSV = (publishersApps: any[]) => { | ||
// Generate CSV using publishersApps data | ||
return publishersApps | ||
.map(app => [app.name, app.publisher, app.status].join(',')) | ||
.join('\n'); | ||
export const GET: RequestHandler = async ({ params }) => { | ||
const domain = params.domain || ''; | ||
const publisher_id = params.publisher_id || ''; | ||
|
||
const response = await fetch( | ||
`http://localhost:8000/api/companies/${domain}/adstxt/publisher/${publisher_id}/download` | ||
); | ||
|
||
// Create response with appropriate headers | ||
return new Response(response.body, { | ||
headers: { | ||
'Content-Type': 'text/csv', | ||
'Content-Disposition': `attachment; filename="adstxt_${domain}_${publisher_id}.csv"` | ||
} | ||
}); | ||
}; | ||
|
||
|
||
|
||
|
||
export const GET: RequestHandler = async ( { params } ) => { | ||
const domain = params.domain || ''; | ||
const publisher_id = params.publisher_id || ''; | ||
|
||
const response = await getPublishersApps(domain, publisher_id); | ||
|
||
// Create response with appropriate headers | ||
return new Response(response.body, { | ||
headers: { | ||
'Content-Type': 'text/csv', | ||
'Content-Disposition': `attachment; filename="adstxt_${domain}_${publisher_id}.csv"` | ||
} | ||
}); | ||
} | ||
|