Use asset-backed company logos
This commit is contained in:
@@ -18,7 +18,6 @@ export const companiesApi = {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
budgetMonthlyCents?: number;
|
||||
logoUrl?: string | null;
|
||||
}) =>
|
||||
api.post<Company>("/companies", data),
|
||||
update: (
|
||||
@@ -26,7 +25,7 @@ export const companiesApi = {
|
||||
data: Partial<
|
||||
Pick<
|
||||
Company,
|
||||
"name" | "description" | "status" | "budgetMonthlyCents" | "requireBoardApprovalForNewAgents" | "brandColor" | "logoUrl"
|
||||
"name" | "description" | "status" | "budgetMonthlyCents" | "requireBoardApprovalForNewAgents" | "brandColor" | "logoAssetId"
|
||||
>
|
||||
>,
|
||||
) => api.patch<Company>(`/companies/${companyId}`, data),
|
||||
|
||||
@@ -28,7 +28,6 @@ interface CompanyContextValue {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
budgetMonthlyCents?: number;
|
||||
logoUrl?: string | null;
|
||||
}) => Promise<Company>;
|
||||
}
|
||||
|
||||
@@ -90,7 +89,6 @@ export function CompanyProvider({ children }: { children: ReactNode }) {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
budgetMonthlyCents?: number;
|
||||
logoUrl?: string | null;
|
||||
}) =>
|
||||
companiesApi.create(data),
|
||||
onSuccess: (company) => {
|
||||
@@ -104,7 +102,6 @@ export function CompanyProvider({ children }: { children: ReactNode }) {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
budgetMonthlyCents?: number;
|
||||
logoUrl?: string | null;
|
||||
}) => {
|
||||
return createMutation.mutateAsync(data);
|
||||
},
|
||||
|
||||
@@ -141,7 +141,7 @@ export function CompanySettings() {
|
||||
mutationFn: (file: File) =>
|
||||
assetsApi
|
||||
.uploadImage(selectedCompanyId!, file, "companies")
|
||||
.then((asset) => companiesApi.update(selectedCompanyId!, { logoUrl: asset.contentPath })),
|
||||
.then((asset) => companiesApi.update(selectedCompanyId!, { logoAssetId: asset.assetId })),
|
||||
onSuccess: (company) => {
|
||||
syncLogoState(company.logoUrl);
|
||||
setLogoUploadError(null);
|
||||
@@ -149,7 +149,7 @@ export function CompanySettings() {
|
||||
});
|
||||
|
||||
const clearLogoMutation = useMutation({
|
||||
mutationFn: () => companiesApi.update(selectedCompanyId!, { logoUrl: null }),
|
||||
mutationFn: () => companiesApi.update(selectedCompanyId!, { logoAssetId: null }),
|
||||
onSuccess: (company) => {
|
||||
setLogoUploadError(null);
|
||||
syncLogoState(company.logoUrl);
|
||||
|
||||
Reference in New Issue
Block a user