FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
lightweight
lightweightglimpse2-runbook-view-glimpse-save-login-react
Remix of lightweight/glimpse2-runbook-view-glimpse-save-login
Public
Like
glimpse2-runbook-view-glimpse-save-login-react
Home
Code
8
_townie
13
backend
7
frontend
9
shared
3
.vtignore
README.md
deno.json
H
main.tsx
Branches
2
Pull requests
Remixes
History
Environment variables
6
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
frontend
/
services
/
README.md
Code
/
frontend
/
services
/
README.md
Search
…
Viewing readonly version of main branch: v21
View latest version
README.md

Frontend Services

This directory contains service functions that handle API calls and external integrations.

Files

glimpseService.ts

Handles glimpse data API calls.

Functions:

  • fetchGlimpseData(glimpseId) - Fetch glimpse data from /glimpse/{id} endpoint

agentService.ts

Handles agent data API calls.

Functions:

  • fetchAgentData(glimpseId) - Fetch agent data from /api/agent/{id} endpoint
  • Returns null for missing agents (expected behavior)

viewingService.ts

Handles viewing status tracking.

Functions:

  • updateViewingStatus(payload) - Send viewing status updates to /api/viewing
  • Silently fails to avoid disrupting user experience

Note: Uses ViewingStatusPayload type from /frontend/types/viewing.ts

cobrowseService.ts

Handles cobrowse session management.

Functions:

  • startCobrowseSession() - Initialize cobrowse session using GLANCE library
  • Includes error handling and user feedback

Usage

import { fetchGlimpseData } from "../services/glimpseService.ts"; import { fetchAgentData } from "../services/agentService.ts"; import { updateViewingStatus } from "../services/viewingService.ts"; import { startCobrowseSession } from "../services/cobrowseService.ts"; // Fetch data const glimpseData = await fetchGlimpseData(glimpseId); const agentData = await fetchAgentData(glimpseId); // Update status await updateViewingStatus({ pageId: glimpseId, viewing: true, tabVisible: true }); // Start cobrowse startCobrowseSession();

Benefits

  • Centralized API logic: All external calls in one place
  • Consistent error handling: Standardized error responses
  • Reusable: Can be used across components and hooks
  • Testable: Easy to mock for unit tests
  • Type-safe: Full TypeScript support
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.