Skip to content
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

chore(common): rename test to example #90

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions space-plugins/nextjs-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ return (
{completed && (
<div>
<UserInfo />
<Test />
<Example />
</div>
)}
</div>
Expand All @@ -104,7 +104,7 @@ After completing both authentications, the `<UserInfo />` component is rendered.

2. If you don't need the Management API but still want to validate the request on the backend:

When the `<Test />` component is rendered, it makes a request to `/api/test`. We attach the App Bridge token as a header. The endpoint verifies the token using `await verifyAppBridgeHeader(req)`. Only if the token is verified can you perform any desired action.
When the `<Example />` component is rendered, it makes a request to `/api/example`. We attach the App Bridge token as a header. The endpoint verifies the token using `await verifyAppBridgeHeader(req)`. Only if the token is verified can you perform any desired action.

### Extension Installation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { APP_BRIDGE_TOKEN_HEADER_KEY, KEY_TOKEN } from '@/utils/const';
import { useEffect, useState } from 'react';

export default function Test() {
export default function Example() {
const [testInfo, setTestInfo] = useState<{ verified: boolean }>({
verified: false,
});
useEffect(() => {
const fetchTestInfo = async () => {
const response = await fetch('/api/test', {
const response = await fetch('/api/example', {
headers: {
[APP_BRIDGE_TOKEN_HEADER_KEY]:
sessionStorage.getItem(KEY_TOKEN) || '',
Expand Down
4 changes: 2 additions & 2 deletions space-plugins/nextjs-starter/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Head from 'next/head';
import { useAppBridge } from '@/hooks';
import UserInfo from '@/components/UserInfo';
import Test from '@/components/Test';
import Example from '@/components/Example';

type User = {
id: number;
Expand All @@ -27,7 +27,7 @@ export default function Home() {
<div>
<p>Authenticated!</p>
<UserInfo />
<Test />
<Example />
</div>
)}
</main>
Expand Down
2 changes: 1 addition & 1 deletion tool-plugins/nextjs-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ return (
{completed && (
<div>
<UserInfo />
<Test />
<Example />
</div>
)}
</div>
Expand Down