Path: blob/main/components/dashboard/src/data/usage/usage-query.ts
2501 views
/**1* Copyright (c) 2023 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { ListUsageRequest, ListUsageResponse } from "@gitpod/gitpod-protocol/lib/usage";7import { useQuery } from "@tanstack/react-query";8import { getGitpodService } from "../../service/service";910export function useListUsage(request: ListUsageRequest) {11const query = useQuery<ListUsageResponse, Error>(12["usage", request],13() => {14return getGitpodService().server.listUsage(request);15},16{17cacheTime: 1000 * 60 * 1, // 1 minutes18staleTime: 1000 * 60 * 1, // 1 minutes19retry: false,20},21);22return query;23}242526