File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 184184
185185{#key data .itinerary .theme_id }
186186 <!-- readOnly は standard-seasons テーマのみ対応。他テーマは issue #159 で対応予定 -->
187+ <!-- ログイン済み && 非オーナーのみ readOnly。未ログインは既存動作を維持 -->
187188 <ItineraryView
188189 {itinerary }
189190 {steps }
190- readOnly ={! data .isOwner }
191- onUpdateItinerary ={! data . isOwner ? undefined : handleUpdateItinerary }
192- onCreateStep ={! data . isOwner ? undefined : handleCreateStep }
193- onUpdateStep ={! data . isOwner ? undefined : handleUpdateStep }
194- onDeleteStep ={! data . isOwner ? undefined : handleDeleteStep }
191+ readOnly ={data . isLoggedIn && ! data .isOwner }
192+ onUpdateItinerary ={handleUpdateItinerary }
193+ onCreateStep ={handleCreateStep }
194+ onUpdateStep ={handleUpdateStep }
195+ onDeleteStep ={handleDeleteStep }
195196 />
196197{/ key }
Original file line number Diff line number Diff line change @@ -7,19 +7,22 @@ import { loadTheme } from '$lib/themes';
77import { error } from '@sveltejs/kit' ;
88
99export const prerender = false ;
10+ // userAuth は localStorage 依存のため SSR では動作しない → CSR のみで実行
11+ export const ssr = false ;
1012
1113export const load : PageLoad = async ( { params } ) => {
1214 try {
1315 const itinerary = await itineraryApi . get ( params . id ) ;
1416 const theme = await loadTheme ( itinerary . theme_id ) ;
1517 const steps = await stepApi . list ( params . id ) ;
1618
19+ const isLoggedIn = userAuth . isLoggedIn ( ) ;
1720 let isOwner = false ;
18- if ( userAuth . isLoggedIn ( ) ) {
21+ if ( isLoggedIn ) {
1922 try {
2023 await userApi . checkOwnership ( params . id ) ;
2124 isOwner = true ;
22- } catch ( e ) {
25+ } catch {
2326 // 404 = bookmark not found (not owner)
2427 // 401 = token expired → isLoggedIn() で事前にチェック済みのため通常発生しない
2528 isOwner = false ;
@@ -30,6 +33,7 @@ export const load: PageLoad = async ({ params }) => {
3033 itinerary,
3134 theme,
3235 steps,
36+ isLoggedIn,
3337 isOwner,
3438 } ;
3539 } catch ( e ) {
Original file line number Diff line number Diff line change 1919 let formError = $state <string | null >(null );
2020 let submitting = $state (false );
2121 let copiedId = $state <string | null >(null );
22+ let copyTimeout: ReturnType <typeof setTimeout > | null = null ;
2223
2324 onMount (async () => {
2425 loggedIn = userAuth .isLoggedIn ();
8182 const url = window .location .origin + ' /' + itineraryId ;
8283 await navigator .clipboard .writeText (url );
8384 copiedId = itineraryId ;
84- setTimeout (() => { copiedId = null ; }, 2000 );
85+ if (copyTimeout ) clearTimeout (copyTimeout );
86+ copyTimeout = setTimeout (() => { copiedId = null ; }, 2000 );
8587 } catch {
8688 alert (' クリップボードへのコピーに失敗しました' );
8789 }
You can’t perform that action at this time.
0 commit comments