mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 11:29:42 +00:00
Rename API token mentions to access token
This commit is contained in:
@@ -27,8 +27,8 @@ import {
|
||||
} from "@app/hooks/api/auth/queries";
|
||||
import { MfaMethod } from "@app/hooks/api/auth/types";
|
||||
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
|
||||
import { ProjectType } from "@app/hooks/api/workspace/types";
|
||||
import { isLoggedIn } from "@app/hooks/api/reactQuery";
|
||||
import { ProjectType } from "@app/hooks/api/workspace/types";
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
const client = new jsrp.client();
|
||||
|
||||
+5
-5
@@ -21,11 +21,11 @@ import {
|
||||
GenericAppConnectionsFields
|
||||
} from "./GenericAppConnectionFields";
|
||||
|
||||
type ApiTokenForm = z.infer<typeof apiTokenSchema>;
|
||||
type AccessTokenForm = z.infer<typeof accessTokenSchema>;
|
||||
|
||||
type Props = {
|
||||
appConnection?: TAzureDevOpsConnection;
|
||||
onSubmit: (formData: ApiTokenForm) => Promise<void>;
|
||||
onSubmit: (formData: AccessTokenForm) => Promise<void>;
|
||||
};
|
||||
|
||||
// Base schema with common fields
|
||||
@@ -41,7 +41,7 @@ const oauthSchema = baseSchema.extend({
|
||||
orgName: z.string().trim().min(1, "Organization name is required")
|
||||
});
|
||||
|
||||
const apiTokenSchema = baseSchema.extend({
|
||||
const accessTokenSchema = baseSchema.extend({
|
||||
method: z.literal(AzureDevOpsConnectionMethod.AccessToken),
|
||||
credentials: z.object({
|
||||
accessToken: z.string().trim().min(1, "Access Token is required"),
|
||||
@@ -50,7 +50,7 @@ const apiTokenSchema = baseSchema.extend({
|
||||
});
|
||||
|
||||
// Union schema
|
||||
const formSchema = z.discriminatedUnion("method", [oauthSchema, apiTokenSchema]);
|
||||
const formSchema = z.discriminatedUnion("method", [oauthSchema, accessTokenSchema]);
|
||||
|
||||
type FormData = z.infer<typeof formSchema>;
|
||||
|
||||
@@ -230,7 +230,7 @@ export const AzureDevOpsConnectionForm = ({ appConnection, onSubmit }: Props) =>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* API Token-specific fields */}
|
||||
{/* Access Token-specific fields */}
|
||||
{selectedMethod === AzureDevOpsConnectionMethod.AccessToken && (
|
||||
<>
|
||||
<Controller
|
||||
|
||||
+3
-3
@@ -48,14 +48,14 @@ type OAuthCredentials = Extract<
|
||||
TAzureDevOpsConnection,
|
||||
{ method: AzureDevOpsConnectionMethod.OAuth }
|
||||
>["credentials"];
|
||||
type ApiTokenCredentials = Extract<
|
||||
type AccessTokenCredentials = Extract<
|
||||
TAzureDevOpsConnection,
|
||||
{ method: AzureDevOpsConnectionMethod.AccessToken }
|
||||
>["credentials"];
|
||||
|
||||
type AzureDevOpsFormData = BaseFormData &
|
||||
Pick<TAzureDevOpsConnection, "name" | "method" | "description"> &
|
||||
(Pick<OAuthCredentials, "tenantId" | "orgName"> | Pick<ApiTokenCredentials, "orgName">);
|
||||
(Pick<OAuthCredentials, "tenantId" | "orgName"> | Pick<AccessTokenCredentials, "orgName">);
|
||||
|
||||
type FormDataMap = {
|
||||
[AppConnection.GitHub]: GithubFormData & { app: AppConnection.GitHub };
|
||||
@@ -287,7 +287,7 @@ export const OAuthCallbackPage = () => {
|
||||
|
||||
try {
|
||||
if (!("tenantId" in formData)) {
|
||||
throw new Error("Expected OAuth form data but got API token data");
|
||||
throw new Error("Expected OAuth form data but got access token data");
|
||||
}
|
||||
|
||||
if (connectionId) {
|
||||
|
||||
Reference in New Issue
Block a user