Merge pull request 'fix: TypeScript type mismatch between UspsValidationResult and local fallback object' (#10) from fix/usps-type-mismatch into main
Reviewed-on: #10
This commit was merged in pull request #10.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Router, Request, Response } from 'express';
|
import { Router, Request, Response } from 'express';
|
||||||
import { pool } from '../db';
|
import { pool } from '../db';
|
||||||
import { requireCustomer } from '../middleware/customerAuth';
|
import { requireCustomer } from '../middleware/customerAuth';
|
||||||
import { validateAddress, uspsConfigured } from '../usps';
|
import { validateAddress, uspsConfigured, UspsValidationResult } from '../usps';
|
||||||
|
|
||||||
const router = Router();
|
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' });
|
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 };
|
let uspsResult: UspsValidationResult = { validated: false, deliverable: null, standardized: null };
|
||||||
if ((country || 'US') === 'US') {
|
if ((country || 'US') === 'US') {
|
||||||
uspsResult = await validateAddress({ addressLine1, addressLine2, city, state, postalCode });
|
uspsResult = await validateAddress({ addressLine1, addressLine2, city, state, postalCode });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user