Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created June 13, 2025 09:42
Show Gist options
  • Save debugmodedotnet/d62e0b4485e4147023900db533759bd4 to your computer and use it in GitHub Desktop.
Save debugmodedotnet/d62e0b4485e4147023900db533759bd4 to your computer and use it in GitHub Desktop.
searchId = signal<string>(this.searchTerm);
productResource = resource({
params: () => ({ id: this.searchId() }),
loader: async (param) => {
const { id } = param.params as { id: string };
console.log('Loading product with id:', id);
let a = await fetch(`http://localhost:3000/product/${id}`)
.then(response => response.json() as Promise<IProduct>)
console.log('Product fetched:', a);
return [a];
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment