fix: 4 bugs - checkout virtual, login redirect, licensing, categories
1. Virtual-only checkout: - Added 'virtual' and 'downloadable' to CartController response - Checkout can now detect virtual-only carts 2. Login redirect: - Added useEffect to redirect logged-in users to /my-account 3. License generation: - Fixed meta key mismatch (_woonoow_licensing_enabled -> _licensing_enabled) 4. Product categories: - Added queryClient.invalidateQueries after creating new category - List now refreshes immediately
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { __ } from '@/lib/i18n';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
@@ -26,6 +27,7 @@ export function OrganizationTab({
|
||||
selectedTags,
|
||||
setSelectedTags,
|
||||
}: OrganizationTabProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const [newCategoryName, setNewCategoryName] = useState('');
|
||||
const [newTagName, setNewTagName] = useState('');
|
||||
const [creatingCategory, setCreatingCategory] = useState(false);
|
||||
@@ -46,7 +48,8 @@ export function OrganizationTab({
|
||||
if (response.id) {
|
||||
setSelectedCategories([...selectedCategories, response.id]);
|
||||
}
|
||||
// Note: Parent component should refetch categories
|
||||
// Invalidate categories query to refresh the list
|
||||
queryClient.invalidateQueries({ queryKey: ['product-categories'] });
|
||||
} catch (error: any) {
|
||||
toast.error(error.message || __('Failed to create category'));
|
||||
} finally {
|
||||
@@ -183,11 +186,10 @@ export function OrganizationTab({
|
||||
setSelectedTags([...selectedTags, tag.id]);
|
||||
}
|
||||
}}
|
||||
className={`px-3 py-1 rounded-full text-sm border transition-colors ${
|
||||
selectedTags.includes(tag.id)
|
||||
className={`px-3 py-1 rounded-full text-sm border transition-colors ${selectedTags.includes(tag.id)
|
||||
? 'bg-primary text-primary-foreground border-primary'
|
||||
: 'bg-background border-border hover:bg-accent'
|
||||
}`}
|
||||
}`}
|
||||
>
|
||||
{tag.name}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user