Skip to content

Commit 7f8a9e8

Browse files
committed
Fix issues from pr comments
1 parent 2400837 commit 7f8a9e8

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

apps/api/src/company/company.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class CompanyController {
5151
}
5252

5353
@UseGuards(SponsorGuard)
54+
@ApiBearerAuth()
5455
@Get('booth-plans')
5556
async getBoothPlans(): Promise<CompanyBoothPlanDto[]> {
5657
return await this.companyService.getBoothPlans();

apps/sponsor/src/formSteps/BoothEquipment/BoothEquipment.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useCompanyGetCurrentPublic } from '../../api/company/useCompanyGetCurre
66
import { useCompanyUpdateEquipment } from '../../api/company/useCompanyUpdateEquipment';
77
import { Input } from '../../components/Input';
88
import { FormComponent } from '../../types/form';
9-
import c from './BoothEquipment.module.scss'; // We will create this or share styles
9+
import c from './BoothEquipment.module.scss';
1010

1111
export type EquipmentItem = {
1212
name: string;
@@ -23,19 +23,20 @@ export const BoothEquipment: FormComponent = ({ close }) => {
2323
const { mutateAsync: updateEquipment } = useCompanyUpdateEquipment();
2424

2525
useEffect(() => {
26-
if (items.length) return;
27-
if (ref.current) {
28-
if (company?.equipment) {
29-
try {
30-
const parsed = JSON.parse(company.equipment);
31-
if (Array.isArray(parsed)) {
32-
setItems(parsed);
33-
}
34-
} catch (e) {
35-
// If parse fails or simple string, maybe handle differently or init empty
36-
console.error('Failed to parse equipment', e);
37-
}
38-
}
26+
if (items.length || !ref.current) return;
27+
28+
if (!company?.equipment) {
29+
ref.current = false;
30+
return;
31+
}
32+
33+
try {
34+
const parsed = JSON.parse(company.equipment);
35+
36+
if (Array.isArray(parsed)) setItems(parsed);
37+
} catch (e) {
38+
console.error('Failed to parse equipment', e);
39+
} finally {
3940
ref.current = false;
4041
}
4142
}, [company?.equipment, items.length]);

apps/sponsor/src/formSteps/BoothPlan/BoothPlan.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ export const BoothPlan: FormComponent = ({ close }) => {
2323
}, [company]);
2424

2525
const handleSave = async () => {
26-
if (company?.id) {
27-
try {
28-
await updateBoothPlan({
29-
boothPlan: boothPlan,
30-
});
31-
toast.success('Plan štanda uspješno spremljen.');
32-
close();
33-
} catch (e) {
34-
toast.error('Došlo je do greške prilikom spremanja.');
35-
}
26+
if (!company?.id) return;
27+
28+
try {
29+
await updateBoothPlan({
30+
boothPlan,
31+
});
32+
toast.success('Plan štanda uspješno spremljen.');
33+
close();
34+
} catch {
35+
toast.error('Došlo je do greške prilikom spremanja.');
3636
}
3737
};
3838

apps/sponsor/src/pages/SpotsPage/SpotsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const SpotsPage = () => {
2020
const { elapsedTime, didFinish } = useCountdown(ISO.SPOTS_OPENING);
2121
const queryClient = useQueryClient();
2222

23+
console.log(allCompanies);
24+
2325
const renderMainContent = () => {
2426
if (currentCompany.isLoading || isLoading) {
2527
return (

0 commit comments

Comments
 (0)