try to fix cahce problem
This commit is contained in:
parent
7c6703354e
commit
01369a743d
Binary file not shown.
@ -183,6 +183,7 @@ app = FastAPI(
|
|||||||
# Allow CORS from frontend domains
|
# Allow CORS from frontend domains
|
||||||
allowed_origins = [
|
allowed_origins = [
|
||||||
"http://localhost:5173",
|
"http://localhost:5173",
|
||||||
|
"http://localhost:5174",
|
||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
"https://my-recipes.dvirlabs.com",
|
"https://my-recipes.dvirlabs.com",
|
||||||
"http://my-recipes.dvirlabs.com",
|
"http://my-recipes.dvirlabs.com",
|
||||||
@ -192,9 +193,8 @@ app.add_middleware(
|
|||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=allowed_origins,
|
allow_origins=allowed_origins,
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
max_age=0, # Disable CORS preflight caching
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -551,12 +551,6 @@ def delete_grocery_list_endpoint(list_id: int, current_user: dict = Depends(get_
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@app.options("/grocery-lists/{list_id}/pin")
|
|
||||||
async def options_pin_grocery_list(list_id: int):
|
|
||||||
"""Handle CORS preflight for pin endpoint"""
|
|
||||||
return Response(status_code=200)
|
|
||||||
|
|
||||||
|
|
||||||
@app.patch("/grocery-lists/{list_id}/pin", response_model=GroceryList)
|
@app.patch("/grocery-lists/{list_id}/pin", response_model=GroceryList)
|
||||||
def toggle_pin_grocery_list_endpoint(list_id: int, current_user: dict = Depends(get_current_user)):
|
def toggle_pin_grocery_list_endpoint(list_id: int, current_user: dict = Depends(get_current_user)):
|
||||||
"""Toggle pin status for a grocery list (owner only)"""
|
"""Toggle pin status for a grocery list (owner only)"""
|
||||||
|
|||||||
@ -124,6 +124,18 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
gap: 1.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.content-wrapper {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar,
|
.sidebar,
|
||||||
.content {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -373,25 +373,7 @@ function App() {
|
|||||||
<PinnedGroceryLists onShowToast={addToast} />
|
<PinnedGroceryLists onShowToast={addToast} />
|
||||||
</aside>
|
</aside>
|
||||||
)}
|
)}
|
||||||
<section className="sidebar">
|
<section className="content-wrapper">
|
||||||
<RecipeSearchList
|
|
||||||
allRecipes={recipes}
|
|
||||||
recipes={getFilteredRecipes()}
|
|
||||||
selectedId={selectedRecipe?.id}
|
|
||||||
onSelect={setSelectedRecipe}
|
|
||||||
searchQuery={searchQuery}
|
|
||||||
onSearchChange={setSearchQuery}
|
|
||||||
filterMealType={filterMealType}
|
|
||||||
onMealTypeChange={setFilterMealType}
|
|
||||||
filterMaxTime={filterMaxTime}
|
|
||||||
onMaxTimeChange={setFilterMaxTime}
|
|
||||||
filterTags={filterTags}
|
|
||||||
onTagsChange={setFilterTags}
|
|
||||||
filterOwner={filterOwner}
|
|
||||||
onOwnerChange={setFilterOwner}
|
|
||||||
/>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="content">
|
<section className="content">
|
||||||
{error && <div className="error-banner">{error}</div>}
|
{error && <div className="error-banner">{error}</div>}
|
||||||
|
|
||||||
@ -452,6 +434,26 @@ function App() {
|
|||||||
currentUser={user}
|
currentUser={user}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section className="sidebar">
|
||||||
|
<RecipeSearchList
|
||||||
|
allRecipes={recipes}
|
||||||
|
recipes={getFilteredRecipes()}
|
||||||
|
selectedId={selectedRecipe?.id}
|
||||||
|
onSelect={setSelectedRecipe}
|
||||||
|
searchQuery={searchQuery}
|
||||||
|
onSearchChange={setSearchQuery}
|
||||||
|
filterMealType={filterMealType}
|
||||||
|
onMealTypeChange={setFilterMealType}
|
||||||
|
filterMaxTime={filterMaxTime}
|
||||||
|
onMaxTimeChange={setFilterMaxTime}
|
||||||
|
filterTags={filterTags}
|
||||||
|
onTagsChange={setFilterTags}
|
||||||
|
filterOwner={filterOwner}
|
||||||
|
onOwnerChange={setFilterOwner}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@ -221,13 +221,15 @@ function NotificationBell({ onShowToast }) {
|
|||||||
width: 420px;
|
width: 420px;
|
||||||
max-height: 550px;
|
max-height: 550px;
|
||||||
background: var(--panel-bg);
|
background: var(--panel-bg);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
opacity: 0.98;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification-header {
|
.notification-header {
|
||||||
|
|||||||
@ -55,7 +55,7 @@ function PinnedGroceryLists({ onShowToast }) {
|
|||||||
<h3 className="note-title">{list.name}</h3>
|
<h3 className="note-title">{list.name}</h3>
|
||||||
<ul className="note-items">
|
<ul className="note-items">
|
||||||
{list.items.length === 0 ? (
|
{list.items.length === 0 ? (
|
||||||
<li className="empty-note">רשימה ריקה</li>
|
<li className="empty-note">הרשימה ריקה</li>
|
||||||
) : (
|
) : (
|
||||||
list.items.map((item, index) => {
|
list.items.map((item, index) => {
|
||||||
const isChecked = item.startsWith("✓ ");
|
const isChecked = item.startsWith("✓ ");
|
||||||
|
|||||||
@ -71,10 +71,7 @@ export const deleteGroceryList = async (id) => {
|
|||||||
export const togglePinGroceryList = async (id) => {
|
export const togglePinGroceryList = async (id) => {
|
||||||
const res = await fetch(`${API_URL}/grocery-lists/${id}/pin`, {
|
const res = await fetch(`${API_URL}/grocery-lists/${id}/pin`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
headers: {
|
headers: getAuthHeaders(),
|
||||||
...getAuthHeaders(),
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
let errorMessage = "Failed to toggle pin status";
|
let errorMessage = "Failed to toggle pin status";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user