feat: correctly re-requesting

This commit is contained in:
2025-05-10 17:42:23 +01:00
parent b4a0383be7
commit cc07ef983f
3 changed files with 5 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import { jwtDecode } from "jwt-decode";
import { type Component, type ParentProps, Show, useContext } from "solid-js"; import { type Component, type ParentProps, Show, useContext } from "solid-js";
import { save_token } from "tauri-plugin-ios-shared-token-api"; import { save_token } from "tauri-plugin-ios-shared-token-api";
import { Notifications, NotificationsContext } from "./notifications"; import { Notifications, NotificationsContext } from "./notifications";
import { useSearchImageContext } from "./contexts/SearchImageContext";
export const isTokenValid = (): boolean => { export const isTokenValid = (): boolean => {
const token = localStorage.getItem("access"); const token = localStorage.getItem("access");
@ -21,7 +22,8 @@ export const isTokenValid = (): boolean => {
}; };
const WithNotifications: Component<ParentProps> = (props) => { const WithNotifications: Component<ParentProps> = (props) => {
const notifications = Notifications(); const { onRefetchImages } = useSearchImageContext();
const notifications = Notifications(onRefetchImages);
return ( return (
<NotificationsContext.Provider value={notifications}> <NotificationsContext.Provider value={notifications}>

View File

@ -17,7 +17,6 @@ import { base, type UserImage } from "./network";
import { useSearchImageContext } from "./contexts/SearchImageContext"; import { useSearchImageContext } from "./contexts/SearchImageContext";
import { A } from "@solidjs/router"; import { A } from "@solidjs/router";
import { useSetEntity } from "./WithEntityDialog"; import { useSetEntity } from "./WithEntityDialog";
import { useNotifications } from "./ProtectedRoute";
import { ProcessingImages } from "./notifications/ProcessingImages"; import { ProcessingImages } from "./notifications/ProcessingImages";
export const Search = () => { export const Search = () => {

View File

@ -24,7 +24,7 @@ type NotificationState = {
>; >;
}; };
export const Notifications = () => { export const Notifications = (onCompleteImage: () => void) => {
const [state, setState] = createStore<NotificationState>({ const [state, setState] = createStore<NotificationState>({
ProcessingImages: {}, ProcessingImages: {},
}); });
@ -66,6 +66,7 @@ export const Notifications = () => {
} }
setState("ProcessingImages", ImageID, undefined); setState("ProcessingImages", ImageID, undefined);
onCompleteImage();
} else { } else {
if (Status !== "in-progress") { if (Status !== "in-progress") {
console.error( console.error(