-
Notifications
You must be signed in to change notification settings - Fork 0
[BUG] S3 저장 url 오류 수정 #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,11 @@ | |
| <meta charset="UTF-8"/> | ||
| <title>Cherry 관리자페이지 - 제품 상세</title> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
|
|
||
| <!-- CSRF (있으면 렌더) --> | ||
| <meta th:if="${_csrf != null}" name="_csrf" th:content="${_csrf.token}"/> | ||
| <meta th:if="${_csrf != null}" name="_csrf_header" th:content="${_csrf.headerName}"/> | ||
|
|
||
| <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/> | ||
| <style> | ||
| .grid { | ||
|
|
@@ -89,6 +94,7 @@ | |
| <h4 class="m-0">제품 상세보기</h4> | ||
| <div class="d-flex gap-2"> | ||
| <a th:href="@{/admin}" class="btn btn-outline-secondary btn-sm">목록으로</a> | ||
| <button type="button" id="deleteBtn" class="btn btn-danger btn-sm">상품 제거</button> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
@@ -178,5 +184,47 @@ <h6 class="fw-bold mb-3">상세 이미지</h6> | |
|
|
||
| </div> | ||
|
|
||
| <script th:inline="javascript"> | ||
| /*<![CDATA[*/ | ||
| // CSRF | ||
| const csrfToken = document.querySelector('meta[name="_csrf"]')?.content; | ||
| const csrfHeader = document.querySelector('meta[name="_csrf_header"]')?.content; | ||
|
|
||
| const productId = /*[[${product.id}]]*/ null; | ||
| const deleteBtn = document.getElementById('deleteBtn'); | ||
|
|
||
| if (deleteBtn && productId) { | ||
| deleteBtn.addEventListener('click', () => { | ||
| if (!confirm('정말로 이 상품을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.')) { | ||
| return; | ||
| } | ||
|
|
||
| const headers = {}; | ||
| if (csrfToken && csrfHeader) { | ||
| headers[csrfHeader] = csrfToken; | ||
| } | ||
|
|
||
| fetch(`/api/v1/product/${productId}`, { | ||
| method: 'DELETE', | ||
| headers: headers | ||
| }) | ||
| .then(response => { | ||
| if (response.status === 204) { | ||
| alert('상품이 성공적으로 삭제되었습니다.'); | ||
| window.location.href = '/admin'; | ||
| } else { | ||
| return response.text().then(text => { | ||
| throw new Error(text || `Error: ${response.status}`); | ||
| }); | ||
| } | ||
| }) | ||
| .catch(error => { | ||
| console.error('Delete failed:', error); | ||
| alert('상품 삭제에 실패했습니다: ' + error.message); | ||
| }); | ||
| }); | ||
| } | ||
| /*]]>*/ | ||
| </script> | ||
| </body> | ||
| </html> | ||
| </html> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.