File tree Expand file tree Collapse file tree 4 files changed +28
-24
lines changed
Expand file tree Collapse file tree 4 files changed +28
-24
lines changed Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { useCompanyGetCurrentPublic } from '../../api/company/useCompanyGetCurre
66import { useCompanyUpdateEquipment } from '../../api/company/useCompanyUpdateEquipment' ;
77import { Input } from '../../components/Input' ;
88import { 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
1111export 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 ] ) ;
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments