Skip to content

Instantly share code, notes, and snippets.

View perjerz's full-sized avatar
🏠
Working from home

Siwat Kaolueng perjerz

🏠
Working from home
View GitHub Profile
@perjerz
perjerz / data-table.component.html
Created November 27, 2022 05:38 — forked from pjlamb12/data-table.component.html
Angular Data Table Component
<content-section
[csTitle]="title"
[collapsible]="collapsible"
[state]="state"
[locked]="locked"
[noButtons]="noButtons"
[buttons]="_buttons"
>
<!-- Custom controls -->
<ng-content></ng-content>
const TMDB_IMAGE_BASE_URL = 'https://image.tmdb.org/t/p/';
addEventListener("fetch", e => {
const url = new URL(e.request.url);
if (url.pathname === "/image") {
e.respondWith((async () => {
const width = url.searchParams.get("width");
const path = url.searchParams.get("path");
try {
return await fetch(`${TMDB_IMAGE_BASE_URL}/w${width}${path}`, {mode: "no-cors"});