File tree Expand file tree Collapse file tree 4 files changed +27
-26
lines changed Expand file tree Collapse file tree 4 files changed +27
-26
lines changed Original file line number Diff line number Diff line change 1
- import { type Person , sleep } from '../page ' ;
1
+ import { type Person } from '../../types ' ;
2
2
import { Metadata } from 'next' ;
3
3
import { notFound } from 'next/navigation' ;
4
+ import sleep from '@/util/sleep' ;
4
5
5
6
type Props = {
6
7
params : { id : string } ;
Original file line number Diff line number Diff line change 1
1
import Link from 'next/link' ;
2
+ import sleep from '@/util/sleep' ;
3
+ import { type Person } from '../types' ;
2
4
3
5
async function getPeople ( ) : Promise < Person [ ] > {
4
6
await sleep ( ) ;
@@ -11,31 +13,6 @@ export const metadata = {
11
13
title : 'Star Wars People' ,
12
14
} ;
13
15
14
- export function sleep ( ms = 2000 ) {
15
- return new Promise ( ( resolve ) => {
16
- setTimeout ( resolve , ms ) ;
17
- } ) ;
18
- }
19
-
20
- export type Person = {
21
- name : string ;
22
- height : string ;
23
- mass : string ;
24
- hair_color : string ;
25
- skin_color : string ;
26
- eye_color : string ;
27
- birth_year : string ;
28
- gender : string ;
29
- homeworld : string ;
30
- films : string [ ] ;
31
- species : string [ ] ;
32
- vehicles : string [ ] ;
33
- starships : string [ ] ;
34
- created : string ;
35
- edited : string ;
36
- url : string ;
37
- } ;
38
-
39
16
export default async function Page ( ) {
40
17
const people = await getPeople ( ) ;
41
18
Original file line number Diff line number Diff line change
1
+ export type Person = {
2
+ name : string ;
3
+ height : string ;
4
+ mass : string ;
5
+ hair_color : string ;
6
+ skin_color : string ;
7
+ eye_color : string ;
8
+ birth_year : string ;
9
+ gender : string ;
10
+ homeworld : string ;
11
+ films : string [ ] ;
12
+ species : string [ ] ;
13
+ vehicles : string [ ] ;
14
+ starships : string [ ] ;
15
+ created : string ;
16
+ edited : string ;
17
+ url : string ;
18
+ } ;
Original file line number Diff line number Diff line change
1
+ export default function sleep ( ms = 2000 ) {
2
+ return new Promise ( ( resolve ) => {
3
+ setTimeout ( resolve , ms ) ;
4
+ } ) ;
5
+ }
You can’t perform that action at this time.
0 commit comments