(() => { const { actions, Handlebars, EventManager } = ShopbySkin; Handlebars.registerHelper('convertDate', function (dateTimeString) { const date = new Date(dateTimeString); const year = date.getFullYear().toString().slice(-2); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}.${month}.${day}`; }); Handlebars.registerHelper('ifGt', function (a, b, options) { if (a > b) { return options.fn(this); } return options.inverse(this); }); const renderNoticeList = async () => { const container = document.querySelector('main-notice-list.board'); if (!container) return; const templateScript = container.querySelector('script[type="text/x-handlebars-template"]'); if (!templateScript) return; const template = Handlebars.compile(templateScript.innerHTML); try { const response = await actions.queryArticlesByBoardNo({ boardNo: 'notice', pageSize: 4, }); const html = template(response.data); container.innerHTML = html; } catch (error) { console.error('[main-notice-list] 공지사항 로드 실패:', error); const html = template({ totalCount: 0, items: [] }); container.innerHTML = html; } }; EventManager.on('PAGE_LOAD_COMPLETED', () => { renderNoticeList(); }); })();