fix: TypeScript type mismatch between UspsValidationResult and local fallback object #10
@@ -1,7 +1,7 @@
|
||||
import { Router, Request, Response } from 'express';
|
||||
import { pool } from '../db';
|
||||
import { requireCustomer } from '../middleware/customerAuth';
|
||||
import { validateAddress, uspsConfigured } from '../usps';
|
||||
import { validateAddress, uspsConfigured, UspsValidationResult } from '../usps';
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -19,8 +19,8 @@ router.post('/', requireCustomer, async (req: Request, res: Response) => {
|
||||
return res.status(400).json({ error: 'fullName, addressLine1, city, state, and postalCode are required' });
|
||||
}
|
||||
|
||||
let uspsResult = { validated: false, deliverable: null as boolean | null, standardized: null as Record<string, unknown> | null, reason: undefined as string | undefined };
|
||||
if ((country || 'US') === 'US') {
|
||||
let uspsResult: UspsValidationResult = { validated: false, deliverable: null, standardized: null };
|
||||
if ((country || 'US') === 'US') {
|
||||
uspsResult = await validateAddress({ addressLine1, addressLine2, city, state, postalCode });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user