FE Auth vendor changes (#270)

This commit is contained in:
Kerem Yilmaz
2024-05-07 11:31:05 -07:00
committed by GitHub
parent 0862232db4
commit 5ce37dfaaf
16 changed files with 99 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
import { client } from "@/api/AxiosClient";
import { getClient } from "@/api/AxiosClient";
import {
ArtifactApiResponse,
ArtifactType,
@@ -7,12 +7,15 @@ import {
import { Skeleton } from "@/components/ui/skeleton";
import { keepPreviousData, useQuery } from "@tanstack/react-query";
import { getImageURL } from "../detail/artifactUtils";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
type Props = {
id: string;
};
function LatestScreenshot({ id }: Props) {
const credentialGetter = useCredentialGetter();
const {
data: artifact,
isFetching,
@@ -20,6 +23,7 @@ function LatestScreenshot({ id }: Props) {
} = useQuery<ArtifactApiResponse | undefined>({
queryKey: ["task", id, "latestScreenshot"],
queryFn: async () => {
const client = await getClient(credentialGetter);
const steps: StepApiResponse[] = await client
.get(`/tasks/${id}/steps`)
.then((response) => response.data);

View File

@@ -1,4 +1,4 @@
import { client } from "@/api/AxiosClient";
import { getClient } from "@/api/AxiosClient";
import { Status, TaskApiResponse } from "@/api/types";
import { useQuery } from "@tanstack/react-query";
import { basicTimeFormat } from "@/util/timeFormat";
@@ -12,12 +12,16 @@ import {
} from "@/components/ui/table";
import { useNavigate } from "react-router-dom";
import { StatusBadge } from "@/components/StatusBadge";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
function QueuedTasks() {
const navigate = useNavigate();
const credentialGetter = useCredentialGetter();
const { data: tasks } = useQuery<Array<TaskApiResponse>>({
queryKey: ["tasks", "queued"],
queryFn: async () => {
const client = await getClient(credentialGetter);
return client
.get("/tasks", {
params: {

View File

@@ -1,4 +1,4 @@
import { client } from "@/api/AxiosClient";
import { getClient } from "@/api/AxiosClient";
import { TaskApiResponse } from "@/api/types";
import { useQuery } from "@tanstack/react-query";
import { useNavigate } from "react-router-dom";
@@ -12,13 +12,16 @@ import {
} from "@/components/ui/card";
import { basicTimeFormat } from "@/util/timeFormat";
import { LatestScreenshot } from "./LatestScreenshot";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
function RunningTasks() {
const navigate = useNavigate();
const credentialGetter = useCredentialGetter();
const { data: runningTasks } = useQuery<Array<TaskApiResponse>>({
queryKey: ["tasks", "running"],
queryFn: async () => {
const client = await getClient(credentialGetter);
return client
.get("/tasks", {
params: {