env context and refactor api support different ports

This commit is contained in:
Milo Schwartz
2024-12-12 22:46:58 -05:00
parent d79760dad9
commit d3d2fe398b
35 changed files with 287 additions and 135 deletions

View File

@@ -4,7 +4,6 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import Link from "next/link";
import api from "@app/api";
import { toast } from "@app/hooks/useToast";
import { useCallback, useEffect, useState } from "react";
import {
@@ -16,6 +15,8 @@ import {
} from "@app/components/ui/card";
import CopyTextBox from "@app/components/CopyTextBox";
import { formatAxiosError } from "@app/lib/utils";
import { createApiClient } from "@app/api";
import { useEnvContext } from "@app/hooks/useEnvContext";
type Step = "org" | "site" | "resources";
@@ -28,6 +29,8 @@ export default function StepperForm() {
const [orgCreated, setOrgCreated] = useState(false);
const [orgIdTaken, setOrgIdTaken] = useState(false);
const api = createApiClient(useEnvContext());
const checkOrgIdAvailability = useCallback(async (value: string) => {
try {
const res = await api.get(`/org/checkId`, {