-
+
{user.display_name}
diff --git a/apps/forge/src/components/signin/dashboard/index.tsx b/apps/forge/src/components/signin/dashboard/index.tsx
index 1a38271..b333a87 100644
--- a/apps/forge/src/components/signin/dashboard/index.tsx
+++ b/apps/forge/src/components/signin/dashboard/index.tsx
@@ -1,3 +1,4 @@
+import { useAuth } from "@/components/auth-provider";
import ActiveLocationSelector from "@/components/signin/ActiveLocationSelector";
import { SignInDrawer } from "@/components/signin/dashboard/components/SignInDrawer.tsx";
import { SignedInUserCard } from "@/components/signin/dashboard/components/SignedInUserCard";
@@ -7,14 +8,14 @@ import { extractError } from "@/lib/utils";
import { AppRootState } from "@/redux/store.ts";
import { dataForLocation } from "@/services/signin/locationService.ts";
import type { QueueEntry, SignInEntry } from "@ignis/types/sign_in";
+import { PartialUserWithTeams } from "@ignis/types/users.ts";
import { ExclamationTriangleIcon, InfoCircledIcon } from "@radix-ui/react-icons";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { Alert, AlertDescription, AlertTitle } from "@ui/components/ui/alert.tsx";
import { Loader } from "@ui/components/ui/loader.tsx";
import { useEffect, useState } from "react";
import { useSelector } from "react-redux";
-import { PartialUserWithTeams } from "@ignis/types/users.ts";
-import { useAuth } from "@/components/auth-provider";
+import { QueuedUserCard } from "./components/QueuedUserCard";
export default function SignInDashboard() {
const queryClient = useQueryClient();
@@ -132,9 +133,7 @@ export default function SignInDashboard() {
)}
{queuedUsers.length > 0 &&
- queuedUsers.map((entry) => {
- return ;
- })}
+ queuedUsers.map((entry) => )}
diff --git a/apps/forge/src/components/ucard-reader/index.tsx b/apps/forge/src/components/ucard-reader/index.tsx
index 1c6f71c..2230da5 100644
--- a/apps/forge/src/components/ucard-reader/index.tsx
+++ b/apps/forge/src/components/ucard-reader/index.tsx
@@ -2,6 +2,7 @@ import { signinActions } from "@/redux/signin.slice";
import { AppDispatch, AppRootState } from "@/redux/store";
import { GetSignIn, PostSignOut } from "@/services/signin/signInService";
import { User } from "@ignis/types/sign_in";
+import { useQueryClient } from "@tanstack/react-query";
import { Link, useNavigate } from "@tanstack/react-router";
import { Button } from "@ui/components/ui/button";
import { useEffect, useState } from "react";
@@ -13,6 +14,7 @@ export default function UCardReader() {
const activeLocation = useSelector((state: AppRootState) => state.signin.active_location);
const dispatch: AppDispatch = useDispatch();
const navigate = useNavigate();
+ const queryClient = useQueryClient();
useEffect(() => {
const down = (e: KeyboardEvent) => {
@@ -76,6 +78,8 @@ export default function UCardReader() {
description: (e as any).toString(),
});
}
+
+ queryClient.invalidateQueries({ queryKey: ["locationStatus", "locationList", { activeLocation }] });
toast.success(`Successfully signed out ${uCardNumber}`);
}),
);
diff --git a/apps/forge/src/services/signin/queueService.ts b/apps/forge/src/services/signin/queueService.ts
index 71accbe..baed2be 100644
--- a/apps/forge/src/services/signin/queueService.ts
+++ b/apps/forge/src/services/signin/queueService.ts
@@ -1,17 +1,18 @@
import axiosInstance from "@/api/axiosInstance.ts";
+import { Location } from "@ignis/types/sign_in";
import axios from "axios";
export interface PostQueueProps {
signal: AbortSignal;
- locationName: string;
+ locationName: Location;
uCardNumber: string;
}
-export const PostQueueInPerson = async ({ locationName, uCardNumber, signal }: PostQueueProps): Promise
=> {
+export const PostQueue = async ({ locationName, uCardNumber, signal }: PostQueueProps): Promise => {
try {
const { data } = await axiosInstance.post(
- `/location/${locationName}/queue/in-person/${uCardNumber}`,
- {},
+ `/location/${locationName}/queue`,
+ { ucard_number: uCardNumber },
{ signal: signal },
);
return data;
@@ -19,7 +20,27 @@ export const PostQueueInPerson = async ({ locationName, uCardNumber, signal }: P
if (axios.isAxiosError(error) && error.response) {
// This is an API error
console.error("API error occurred while posting to /queue/in-person:", error.response.data);
- throw new Error(error.response.data.message || "An error occurred with the API.");
+ throw error;
+ }
+ // This is an Axios error (network problem, etc.)
+ throw error;
+ }
+};
+
+export interface DeleteQueueProps {
+ locationName: Location;
+ id: string;
+}
+
+export const DeleteQueue = async ({ locationName, id }: DeleteQueueProps): Promise => {
+ try {
+ const { data } = await axiosInstance.delete(`/location/${locationName}/queue/${id}`);
+ return data;
+ } catch (error) {
+ if (axios.isAxiosError(error) && error.response) {
+ // This is an API error
+ console.error("API error occurred while posting to /queue/in-person:", error.response.data);
+ throw error;
}
// This is an Axios error (network problem, etc.)
throw error;
diff --git a/packages/types/sign_in.ts b/packages/types/sign_in.ts
index 9e954c3..b00c950 100644
--- a/packages/types/sign_in.ts
+++ b/packages/types/sign_in.ts
@@ -28,6 +28,7 @@ export type QueueEntry = {
user: users.PartialUser;
position: number;
created_at: Date;
+ can_sign_in: boolean;
};
/** The type of the location/:location endpoint storing data on who's logged in for the dashboard */