Add product applicability controls to promotion forms
Introduces product selection and exclusion controls to both new and edit promotion forms, allowing promotions to target all, specific, or all-but-specific products. Adds a reusable ProductSelector component, updates promotion types to support new fields, and adjusts cookie max-age for authentication. Also adds two new business quotes.
This commit is contained in:
@@ -31,8 +31,8 @@ export async function POST(req: NextRequest) {
|
||||
const cookieOptions = {
|
||||
// HttpOnly for security - prevents JavaScript access
|
||||
httpOnly: true,
|
||||
// Valid for 7 days (same as the JWT)
|
||||
maxAge: 7 * 24 * 60 * 60,
|
||||
// Valid for 3 hours
|
||||
maxAge: 3 * 60 * 60,
|
||||
// Only send in requests to our domain
|
||||
path: '/',
|
||||
// Strict same-site policy to prevent CSRF
|
||||
|
||||
@@ -66,7 +66,7 @@ export default function LoginForm() {
|
||||
|
||||
if (response.ok && data.token) {
|
||||
// Store the token in both cookie and localStorage for redundancy
|
||||
document.cookie = `Authorization=${data.token}; path=/; Secure; SameSite=Strict; max-age=604800`;
|
||||
document.cookie = `Authorization=${data.token}; path=/; Secure; SameSite=Strict; max-age=10800`;
|
||||
localStorage.setItem("Authorization", data.token);
|
||||
|
||||
// Show success notification
|
||||
|
||||
@@ -361,8 +361,6 @@ export default function OrderDetailsPage() {
|
||||
const productNamesMap = await fetchProductNames(productIds, authToken);
|
||||
setProductNames(productNamesMap);
|
||||
|
||||
// Add a short timeout to ensure any products still showing as loading
|
||||
// are marked as deleted/unknown
|
||||
setTimeout(() => {
|
||||
setProductNames(prev => {
|
||||
const newMap = {...prev};
|
||||
@@ -373,7 +371,7 @@ export default function OrderDetailsPage() {
|
||||
});
|
||||
return newMap;
|
||||
});
|
||||
}, 3000); // 3 second timeout
|
||||
}, 3000);
|
||||
|
||||
if (data.status === "paid") {
|
||||
setIsPaid(true);
|
||||
|
||||
Reference in New Issue
Block a user