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:
Fabricio Silva 2023-09-10 15:59:59 +01:00 committed by GitHub
parent 438902137b
commit 6a4d96f988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -81,7 +81,7 @@ func (s Server) Open() error {
}
server := http.Server{
Handler: s.Handler(),
Handler: s.Handler(),
ReadHeaderTimeout: time.Second * 15,
}

View file

@ -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>
)
}
);
};

View file

@ -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)
});