Home / Function/ addToUserCart() — astro Function Reference

addToUserCart() — astro Function Reference

Architecture documentation for the addToUserCart() function in api.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  29501144_0025_273b_2c5c_04c6e7a21922["addToUserCart()"]
  598c0643_11b3_ec0d_95c2_89292edee2e9["api.ts"]
  29501144_0025_273b_2c5c_04c6e7a21922 -->|defined in| 598c0643_11b3_ec0d_95c2_89292edee2e9
  style 29501144_0025_273b_2c5c_04c6e7a21922 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

examples/ssr/src/api.ts lines 55–69

export async function addToUserCart(id: number | string, name: string): Promise<void> {
	await fetch(`${location.origin}/api/cart`, {
		credentials: 'same-origin',
		method: 'POST',
		mode: 'no-cors',
		headers: {
			'Content-Type': 'application/json',
			Cache: 'no-cache',
		},
		body: JSON.stringify({
			id,
			name,
		}),
	});
}

Domain

Subdomains

Frequently Asked Questions

What does addToUserCart() do?
addToUserCart() is a function in the astro codebase, defined in examples/ssr/src/api.ts.
Where is addToUserCart() defined?
addToUserCart() is defined in examples/ssr/src/api.ts at line 55.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free