mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(config): check for updates reading from config (#1038)
* go indent linting * getLatest endpoint follows config.CheckForUpdates * Revert "getLatest endpoint follows config.CheckForUpdates" This reverts commit 495fabad13b1a96aa83ce50792f5725e9b51061a. * getLatestRelease follows config.check_for_updates * revert: rename data - less changes to conflict * fixup: revert: rename data - less changes to conflict * change queryFn to arrow function
This commit is contained in:
parent
438902137b
commit
6a4d96f988
3 changed files with 14 additions and 4 deletions
|
@ -81,7 +81,7 @@ func (s Server) Open() error {
|
|||
}
|
||||
|
||||
server := http.Server{
|
||||
Handler: s.Handler(),
|
||||
Handler: s.Handler(),
|
||||
ReadHeaderTimeout: time.Second * 15,
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,20 @@ import { RightNav } from "./RightNav";
|
|||
import { MobileNav } from "./MobileNav";
|
||||
|
||||
export const Header = () => {
|
||||
const { data: config } = useQuery({
|
||||
queryKey: ["config"],
|
||||
queryFn: () => APIClient.config.get(),
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
onError: err => console.log(err)
|
||||
});
|
||||
|
||||
const { data } = useQuery({
|
||||
queryKey: ["updates"],
|
||||
queryFn: () => APIClient.updates.getLatestRelease(),
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
enabled: config?.check_for_updates === true,
|
||||
onError: err => console.log(err)
|
||||
});
|
||||
|
||||
|
@ -67,7 +76,7 @@ export const Header = () => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{data && data.html_url && (
|
||||
{data?.html_url && (
|
||||
<a href={data.html_url} target="_blank" rel="noopener noreferrer">
|
||||
<div className="flex mt-4 py-2 bg-blue-500 rounded justify-center">
|
||||
<MegaphoneIcon className="h-6 w-6 text-blue-100" />
|
||||
|
@ -82,5 +91,5 @@ export const Header = () => {
|
|||
</>
|
||||
)}
|
||||
</Disclosure>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
@ -88,6 +88,7 @@ function ApplicationSettings() {
|
|||
queryFn: APIClient.updates.getLatestRelease,
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
enabled: data?.check_for_updates === true,
|
||||
onError: err => console.log(err)
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue