Skip to content

Commit a35a318

Browse files
committed
fixup
1 parent 5b7ab9c commit a35a318

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

packages/sdk/examples/next-app/app/page.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import { createClient } from "../../../src/browser"
66

77
const publicKey = process.env.NEXT_PUBLIC_PIPEDREAM_PROJECT_PUBLIC_KEY
88
const frontendHost = process.env.NEXT_PUBLIC_PIPEDREAM_FRONTEND_HOST
9-
const appSlug = process.env.NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID
10-
11-
if (!publicKey) throw new Error("Missing NEXT_PUBLIC_PIPEDREAM_PROJECT_PUBLIC_KEY env var")
12-
if (!appSlug) throw new Error("Missing NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID env var")
13-
14-
const pd = createClient({ publicKey, frontendHost })
9+
const oauthAppId = process.env.NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID
10+
const appSlug = process.env.NEXT_PUBLIC_PIPEDREAM_APP_SLUG
1511

1612
export default function Home() {
13+
if (!publicKey) throw new Error("Missing NEXT_PUBLIC_PIPEDREAM_PROJECT_PUBLIC_KEY env var")
14+
if (!oauthAppId) throw new Error("Missing NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID env var")
15+
if (!appSlug) throw new Error("Missing NEXT_PUBLIC_PIPEDREAM_APP_SLUG env var")
16+
17+
const pd = createClient({ publicKey, frontendHost })
1718
const [externalUserId, setExternalUserId] = useState<string | null>(null)
1819
const [githubData, setGithubData] = useState<{ login: string } | null>(null)
1920
const [token, setToken] = useState<string | null>(null)
@@ -34,8 +35,8 @@ export default function Home() {
3435
}
3536

3637
const connectAccount = async () => {
37-
if (appSlug) connectApp(appSlug)
38-
else console.error("Missing NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID env var")
38+
connectApp(oauthAppId as string)
39+
3940
}
4041

4142
const signIn = () => {

packages/sdk/examples/next-app/app/server.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33
import { createClient } from "../../../src";
44

55
const {
6-
PIPEDREAM_PROJECT_SECRET_KEY, NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID,
6+
PIPEDREAM_PROJECT_SECRET_KEY,
7+
NEXT_PUBLIC_PIPEDREAM_APP_SLUG,
78
} = process.env;
89

9-
if (!PIPEDREAM_PROJECT_SECRET_KEY) {
10-
throw new Error("PIPEDREAM_PROJECT_SECRET_KEY not set in environment");
11-
}
12-
13-
if (!NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID) {
14-
throw new Error("NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID not set in environment");
15-
}
10+
if (!PIPEDREAM_PROJECT_SECRET_KEY) throw new Error("PIPEDREAM_PROJECT_SECRET_KEY not set in environment");
11+
if (!NEXT_PUBLIC_PIPEDREAM_APP_SLUG) throw new Error("NEXT_PUBLIC_PIPEDREAM_APP_SLUG not set in environment");
1612

1713
const pd = createClient({
1814
secretKey: PIPEDREAM_PROJECT_SECRET_KEY,
@@ -37,11 +33,11 @@ export async function getAppsData(clientUserId: string) {
3733
}
3834

3935
export async function getGithubData(clientUserId: string) {
40-
if (!NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID) {
41-
throw new Error("NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID not set in environment");
36+
if (!NEXT_PUBLIC_PIPEDREAM_APP_SLUG) {
37+
throw new Error("NEXT_PUBLIC_PIPEDREAM_APP_SLUG not set in environment");
4238
}
4339
const data = await pd.getAccount({
44-
app: NEXT_PUBLIC_PIPEDREAM_TEST_APP_ID,
40+
app: NEXT_PUBLIC_PIPEDREAM_APP_SLUG,
4541
clientUserId,
4642
}, {
4743
includeCredentials: true,

0 commit comments

Comments
 (0)