Skip to content

Commit c36d68a

Browse files
authored
Merge pull request #82 from TukaTek/feature/middleware/TUK-112
Feature/middleware/tuk 112
2 parents d5ec3e5 + fb6e6f4 commit c36d68a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

web/src/app/admin/documents/sets/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ const EditRow = ({
126126
<div
127127
className={`
128128
text-text-darkerfont-medium my-auto p-1 hover:bg-accent-background flex items-center select-none
129-
${documentSet.is_up_to_date ? "cursor-pointer" : "cursor-default"}
129+
${documentSet?.is_up_to_date ? "cursor-pointer" : "cursor-default"}
130130
`}
131131
style={{ wordBreak: "normal", overflowWrap: "break-word" }}
132132
onClick={() => {
133-
if (documentSet.is_up_to_date) {
133+
if (documentSet?.is_up_to_date) {
134134
router.push(`/admin/documents/sets/${documentSet.id}`);
135135
}
136136
}}
@@ -221,7 +221,7 @@ const DocumentSetTable = ({
221221
</TableCell>
222222
<TableCell>
223223
<div>
224-
{documentSet.cc_pair_descriptors.map(
224+
{documentSet?.cc_pair_descriptors?.map(
225225
(ccPairDescriptor:any, ind:any) => {
226226
return (
227227
<div
@@ -248,11 +248,11 @@ const DocumentSetTable = ({
248248
</div>
249249
</TableCell>
250250
<TableCell>
251-
{documentSet.is_up_to_date ? (
251+
{documentSet?.is_up_to_date ? (
252252
<Badge variant="success" icon={FiCheckCircle}>
253253
Up to Date
254254
</Badge>
255-
) : documentSet.cc_pair_descriptors.length > 0 ? (
255+
) : documentSet?.cc_pair_descriptors?.length > 0 ? (
256256
<Badge variant="in_progress" icon={FiClock}>
257257
Syncing
258258
</Badge>
@@ -375,7 +375,7 @@ const Main = () => {
375375
/>
376376
</div>
377377

378-
{documentSets.length > 0 && (
378+
{documentSets?.length > 0 && (
379379
<>
380380
<Separator />
381381
<DocumentSetTable

web/src/components/health/healthcheck.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import { NEXT_PUBLIC_CUSTOM_REFRESH_URL } from "@/lib/constants";
1111
import { Button } from "../ui/button";
1212
import { logout } from "@/lib/user";
1313
import { usePathname, useRouter } from "next/navigation";
14+
import { middlewareUrl } from "@/utils/constant";
1415
export const HealthCheckBanner = () => {
1516
const router = useRouter();
16-
const { error } = useSWR("/api/health", errorHandlingFetcher);
17+
const { error } = useSWR(middlewareUrl+"/health", errorHandlingFetcher);
1718
const [expired, setExpired] = useState(false);
1819
const [showLoggedOutModal, setShowLoggedOutModal] = useState(false);
1920
const pathname = usePathname();
@@ -25,7 +26,9 @@ export const HealthCheckBanner = () => {
2526
data: user,
2627
mutate: mutateUser,
2728
error: userError,
28-
} = useSWR<User>("/api/me", errorHandlingFetcher, {
29+
// } = useSWR<User>("/api/me", errorHandlingFetcher, {
30+
} = useSWR<User>(middlewareUrl+"/me", errorHandlingFetcher, {
31+
2932
revalidateOnFocus: false,
3033
revalidateOnReconnect: false,
3134
dedupingInterval: 30000, // 30 seconds

web/src/lib/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const getCurrentUser = async (
88
includePreferences: boolean = true,
99
includeTenantInfo: boolean = true
1010
): Promise<User | null> => {
11-
const url = new URL(middlewareUrl+"/api/me", window.location.origin);
11+
const url = new URL(middlewareUrl+"/me", window.location.origin);
1212
url.searchParams.set("include_preferences", String(includePreferences));
1313
url.searchParams.set("include_tenant_info", String(includeTenantInfo));
1414

0 commit comments

Comments
 (0)