-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
25 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
export async function getData() { | ||
// eslint-disable-next-line | ||
return await new Promise((resolve) => setTimeout(resolve, 1000)).then((_) => 'Success!'); | ||
} | ||
import { getExample } from 'app/server/example/action'; | ||
|
||
export default async function FetchingComponent() { | ||
const data = await getData(); | ||
const data = await getExample(); | ||
|
||
return <div className="">{data}</div>; | ||
return ( | ||
<div className=""> | ||
<h1>{data.title}</h1> | ||
<span>{data.description}</span> | ||
</div> | ||
); | ||
} |
This file contains 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 |
---|---|---|
@@ -1,19 +1,16 @@ | ||
import Loading from 'app/common/components/ui/loading'; | ||
import { Suspense } from 'react'; | ||
|
||
import ClientComponent from './client-component'; | ||
import FetchingComponent from './fetching-component'; | ||
|
||
export const runtime = 'edge'; | ||
export const revalidate = 0; | ||
|
||
export default function ExamplePage() { | ||
return ( | ||
<main className="flex min-h-screen flex-col items-center p-8"> | ||
<Suspense fallback={<Loading />}> | ||
<FetchingComponent /> | ||
</Suspense> | ||
|
||
<ClientComponent /> | ||
</main> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use server'; | ||
|
||
import type { IExample } from 'app/server/example/interfaces'; | ||
|
||
export async function getExample() { | ||
// const data = await getExample() <- this is where you would call your service | ||
const data: IExample = { | ||
title: 'hello world!', | ||
description: 'This is an example route.', | ||
}; | ||
|
||
return data; | ||
} |
File renamed without changes.
This file contains 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 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