File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed
Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
2+ import LucideArrowLeft from ' ~icons/lucide/arrow-left' ;
3+
24 export let status: number = 500 ;
35 export let error: { message? : string } | null = null ;
46
2022 <p class ="m-0 text-2xl font-bold text-lavender" >{meaning }</p >
2123 </div >
2224 </header >
25+
26+ <button
27+ on:click ={() => window .history .back ()}
28+ class =" inline-flex items-center gap-2 rounded-md bg-surface0/50 px-4 py-2 text-sm font-medium text-text hover:bg-surface0 cursor-pointer"
29+ >
30+ <LucideArrowLeft class =" h-4 w-4" aria-hidden =" true" />
31+ <span >Go Back</span >
32+ </button >
2333</section >
Original file line number Diff line number Diff line change 11import type { PageServerLoad } from './$types' ;
22import type { ProfileResponse } from '$lib/types/profile' ;
33import { createApi , ApiError } from '$lib/api/api' ;
4- import { error } from '@sveltejs/kit' ;
54
65export const load : PageServerLoad = async ( { fetch, params } ) => {
7- const loadProfile = async ( ) : Promise < ProfileResponse > => {
6+ const loadProfile = async ( ) : Promise < ProfileResponse | null > => {
87 try {
98 const api = createApi ( fetch ) ;
109 return await api . get < ProfileResponse > ( `/page/profile/${ params . slug } ` ) ;
1110 } catch ( e ) {
12- console . error ( 'Error loading profile page data:' , e ) ;
13- const err = e as ApiError ;
14- throw error ( err . status || 500 , err . message ) ;
11+ if ( e instanceof ApiError && e . status === 404 ) {
12+ return null ;
13+ }
14+ throw e ;
1515 }
1616 } ;
1717
Original file line number Diff line number Diff line change 4343
4444{#if deferred .showSkeleton }
4545 <ProfileSkeleton />
46+ {:else if deferred .data === null }
47+ <PageScaffold title ="Not Found" showLastUpdated ={false }>
48+ <EmptyState
49+ title =" Profile not found"
50+ description =" The user you're looking for doesn't exist :("
51+ className =" mb-4"
52+ />
53+ </PageScaffold >
4654{:else if deferred .data }
4755 {@const profileData = deferred .data }
4856 <PageScaffold title ="@ {profileData .user .username }" showLastUpdated ={false }>
You can’t perform that action at this time.
0 commit comments