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 { 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}>
|
||||||
|
@ -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 = () => {
|
||||||
|
@ -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(
|
||||||
|
Reference in New Issue
Block a user