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 { save_token } from "tauri-plugin-ios-shared-token-api";
import { Notifications, NotificationsContext } from "./notifications";
import { useSearchImageContext } from "./contexts/SearchImageContext";
export const isTokenValid = (): boolean => {
const token = localStorage.getItem("access");
@ -21,7 +22,8 @@ export const isTokenValid = (): boolean => {
};
const WithNotifications: Component<ParentProps> = (props) => {
const notifications = Notifications();
const { onRefetchImages } = useSearchImageContext();
const notifications = Notifications(onRefetchImages);
return (
<NotificationsContext.Provider value={notifications}>

View File

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

View File

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