feat: correctly re-requesting
This commit is contained in:
@ -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}>
|
||||
|
@ -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 = () => {
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user