Skip to content

Commit b091a04

Browse files
committed
refactor(env): add internal API token to environment configuration
1 parent 8529ea0 commit b091a04

13 files changed

Lines changed: 22 additions & 23 deletions

File tree

apps/app/src/actions/safe-action.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ export const authActionClient = actionClientWithMeta
126126
}
127127

128128
if (metadata.track) {
129-
track(ctx.user.id, metadata.track.event, {
129+
track(ctx.user!.id, metadata.track.event, {
130130
channel: metadata.track.channel,
131-
email: ctx.user.email,
132-
name: ctx.user.name,
131+
email: ctx.user!.email,
132+
name: ctx.user!.name,
133133
organizationId: ctx.session.activeOrganizationId,
134134
});
135135
}
@@ -160,9 +160,9 @@ export const authActionClient = actionClientWithMeta
160160
const { fileData: _, ...inputForAuditLog } = (clientInput || {}) as any;
161161

162162
const data = {
163-
userId: ctx.user.id,
164-
email: ctx.user.email,
165-
name: ctx.user.name,
163+
userId: ctx.user!.id,
164+
email: ctx.user!.email,
165+
name: ctx.user!.name,
166166
organizationId: ctx.session.activeOrganizationId,
167167
action: metadata.name,
168168
input: inputForAuditLog,
@@ -209,7 +209,7 @@ export const authActionClient = actionClientWithMeta
209209
data: {
210210
data: JSON.stringify(data),
211211
memberId: member.id,
212-
userId: ctx.user.id,
212+
userId: ctx.user!.id,
213213
description: metadata.track?.description || null,
214214
organizationId: ctx.session.activeOrganizationId,
215215
entityId,

apps/app/src/app/(app)/[orgId]/components/AppShellWrapper.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ function AppShellWrapperContent({
120120
isQuestionnaireEnabled,
121121
isTrustNdaEnabled,
122122
isAdvancedModeEnabled: organization.advancedModeEnabled,
123-
permissions,
124123
});
125124

126125
return (

apps/app/src/app/(app)/[orgId]/documents/components/CompanyFormPageClient.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function CompanyFormPageClient({
9898
const { data, isLoading } = useSWR<EvidenceFormResponse>(
9999
swrKey,
100100
async ([endpoint, orgId]: readonly [string, string]) => {
101-
const response = await api.get<EvidenceFormResponse>(endpoint, orgId);
101+
const response = await api.get<EvidenceFormResponse>(endpoint);
102102
if (response.error || !response.data) {
103103
throw new Error(response.error ?? 'Failed to load evidence form submissions');
104104
}

apps/app/src/app/(app)/[orgId]/documents/components/CompanyOverviewCards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function CompanyOverviewCards({ organizationId }: { organizationId: strin
3232
const { data: statuses } = useSWR<FormStatuses>(
3333
swrKey,
3434
async ([endpoint, orgId]: readonly [string, string]) => {
35-
const response = await api.get<FormStatuses>(endpoint, orgId);
35+
const response = await api.get<FormStatuses>(endpoint);
3636
if (response.error || !response.data) {
3737
throw new Error(response.error ?? 'Failed to load form statuses');
3838
}

apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionDetailPageClient.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function CompanySubmissionDetailPageClient({
8787
const { data, isLoading, error, mutate } = useSWR<EvidenceSubmissionResponse>(
8888
swrKey,
8989
async ([path, orgId]: readonly [string, string]) => {
90-
const response = await api.get<EvidenceSubmissionResponse>(path, orgId);
90+
const response = await api.get<EvidenceSubmissionResponse>(path);
9191
if (response.error || !response.data) {
9292
throw new Error(response.error ?? 'Failed to load submission');
9393
}
@@ -113,7 +113,6 @@ export function CompanySubmissionDetailPageClient({
113113
const response = await api.patch(
114114
`/v1/evidence-forms/${formType}/submissions/${submissionId}/review`,
115115
{ action, reason: reviewReason.trim() || undefined },
116-
organizationId,
117116
);
118117

119118
if (response.error) {

apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionWizard.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ export function CompanySubmissionWizard({
130130
fileType: file.type || 'application/octet-stream',
131131
fileData,
132132
},
133-
organizationId,
134133
);
135134

136135
if (response.error || !response.data) {
@@ -222,7 +221,6 @@ export function CompanySubmissionWizard({
222221
const response = await api.post(
223222
`/v1/evidence-forms/${formType}/submissions`,
224223
payload,
225-
organizationId,
226224
);
227225

228226
if (response.error) {

apps/app/src/app/(app)/[orgId]/people/[employeeId]/actions/update-employee.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const updateEmployee = authActionClient
4444
const currentUserMember = await db.member.findFirst({
4545
where: {
4646
organizationId: organizationId,
47-
userId: ctx.user.id,
47+
userId: ctx.user!.id,
4848
},
4949
});
5050

apps/app/src/app/(app)/[orgId]/people/all/actions/addEmployeeWithoutInvite.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ export const addEmployeeWithoutInvite = async ({
110110
} else {
111111
// No existing member, create a new one
112112
member = await auth.api.addMember({
113+
headers: await headers(),
113114
body: {
114115
userId: finalUserId,
115116
organizationId,
116-
role: roles, // Auth API expects role or role array
117+
role: roles.join(','),
117118
},
118119
});
119120
}

apps/app/src/app/(app)/[orgId]/people/all/actions/reactivateMember.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const reactivateMember = authActionClient
3434
const currentUserMember = await db.member.findFirst({
3535
where: {
3636
organizationId: ctx.session.activeOrganizationId,
37-
userId: ctx.user.id,
37+
userId: ctx.user!.id,
3838
deactivated: false,
3939
},
4040
});

apps/app/src/app/(app)/[orgId]/people/all/actions/removeMember.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const removeMember = authActionClient
4242
const currentUserMember = await db.member.findFirst({
4343
where: {
4444
organizationId: ctx.session.activeOrganizationId,
45-
userId: ctx.user.id,
45+
userId: ctx.user!.id,
4646
deactivated: false,
4747
},
4848
});
@@ -84,7 +84,7 @@ export const removeMember = authActionClient
8484
}
8585

8686
// Prevent self-removal
87-
if (targetMember.userId === ctx.user.id) {
87+
if (targetMember.userId === ctx.user!.id) {
8888
return {
8989
success: false,
9090
error: 'You cannot remove yourself from the organization',
@@ -296,7 +296,7 @@ export const removeMember = authActionClient
296296
}
297297

298298
revalidatePath(`/${ctx.session.activeOrganizationId}/settings/users`);
299-
revalidateTag(`user_${ctx.user.id}`, 'max');
299+
revalidateTag(`user_${ctx.user!.id}`, 'max');
300300

301301
return {
302302
success: true,

0 commit comments

Comments
 (0)