File tree Expand file tree Collapse file tree 6 files changed +19
-16
lines changed
team/[team_slug]/[project_slug]
connect/account-abstraction Expand file tree Collapse file tree 6 files changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ export async function getAPIKey(apiKeyId: string) {
3737
3838export async function getApiKeys ( ) {
3939 const authToken = getAuthToken ( ) ;
40+
4041 const res = await fetch ( `${ API_SERVER_URL } /v1/keys` , {
4142 method : "GET" ,
42-
4343 headers : {
4444 "Content-Type" : "application/json" ,
4545 Authorization : `Bearer ${ authToken } ` ,
@@ -53,3 +53,11 @@ export async function getApiKeys() {
5353
5454 return json . data as ApiKey [ ] ;
5555}
56+
57+ export function getAPIKeyForProjectId ( projectId : string ) {
58+ if ( projectId . startsWith ( "prj_" ) ) {
59+ return getAPIKey ( projectId . slice ( "prj_" . length ) ) ;
60+ }
61+
62+ return getAPIKey ( projectId ) ;
63+ }
Original file line number Diff line number Diff line change 11import { getProject } from "@/api/projects" ;
22import { ChakraProviderSetup } from "@/components/ChakraProviderSetup" ;
33import { notFound } from "next/navigation" ;
4- import { getAPIKey } from "../../../../../api/lib/getAPIKeys" ;
4+ import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys" ;
55import { AccountAbstractionPage } from "./AccountAbstractionPage" ;
66
77export default async function Page ( props : {
@@ -14,8 +14,7 @@ export default async function Page(props: {
1414 notFound ( ) ;
1515 }
1616
17- // THIS IS A WORKAROUND - project does not have `services` info - so we fetch APIKey object.
18- const apiKey = await getAPIKey ( project . id ) ;
17+ const apiKey = await getAPIKeyForProjectId ( project . id ) ;
1918
2019 if ( ! apiKey ) {
2120 notFound ( ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { getProject } from "@/api/projects";
22import { ChakraProviderSetup } from "@/components/ChakraProviderSetup" ;
33import { notFound } from "next/navigation" ;
44import { AccountAbstractionSettingsPage } from "../../../../../../components/smart-wallets/SponsorshipPolicies" ;
5- import { getAPIKey } from "../../../../../api/lib/getAPIKeys" ;
5+ import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys" ;
66
77export default async function Page ( props : {
88 params : { team_slug : string ; project_slug : string } ;
@@ -14,8 +14,7 @@ export default async function Page(props: {
1414 notFound ( ) ;
1515 }
1616
17- // THIS IS A WORKAROUND - project does not have `services` info - so we fetch APIKey object.
18- const apiKey = await getAPIKey ( project . id ) ;
17+ const apiKey = await getAPIKeyForProjectId ( project . id ) ;
1918
2019 if ( ! apiKey ) {
2120 notFound ( ) ;
Original file line number Diff line number Diff line change 11import { getProject } from "@/api/projects" ;
22import { notFound } from "next/navigation" ;
33import { InAppWalletSettingsPage } from "../../../../../../components/embedded-wallets/Configure" ;
4- import { getAPIKey } from "../../../../../api/lib/getAPIKeys" ;
4+ import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys" ;
55
66export default async function Page ( props : {
77 params : { team_slug : string ; project_slug : string } ;
@@ -13,8 +13,7 @@ export default async function Page(props: {
1313 notFound ( ) ;
1414 }
1515
16- // THIS IS A WORKAROUND - project does not have `services` info - so we fetch APIKey object.
17- const apiKey = await getAPIKey ( project . id ) ;
16+ const apiKey = await getAPIKeyForProjectId ( project . id ) ;
1817
1918 if ( ! apiKey ) {
2019 notFound ( ) ;
Original file line number Diff line number Diff line change 11import { getProject } from "@/api/projects" ;
22import { notFound } from "next/navigation" ;
3- import { getAPIKey } from "../../../../api/lib/getAPIKeys" ;
3+ import { getAPIKeyForProjectId } from "../../../../api/lib/getAPIKeys" ;
44import { ProjectGeneralSettingsPageForTeams } from "./ProjectGeneralSettingsPageForTeams" ;
55
66export default async function Page ( props : {
@@ -13,8 +13,7 @@ export default async function Page(props: {
1313 notFound ( ) ;
1414 }
1515
16- // THIS IS A WORKAROUND - project does not have `services` info - so we fetch APIKey object.
17- const apiKey = await getAPIKey ( project . id ) ;
16+ const apiKey = await getAPIKeyForProjectId ( project . id ) ;
1817
1918 if ( ! apiKey ) {
2019 notFound ( ) ;
Original file line number Diff line number Diff line change 11import { getProject } from "@/api/projects" ;
22import { notFound } from "next/navigation" ;
33import { PayConfig } from "../../../../../../components/pay/PayConfig" ;
4- import { getAPIKey } from "../../../../../api/lib/getAPIKeys" ;
4+ import { getAPIKeyForProjectId } from "../../../../../api/lib/getAPIKeys" ;
55
66export default async function Page ( props : {
77 params : {
@@ -16,8 +16,7 @@ export default async function Page(props: {
1616 notFound ( ) ;
1717 }
1818
19- // THIS IS A WORKAROUND - project does not have `services` info - so we fetch APIKey object.
20- const apiKey = await getAPIKey ( project . id ) ;
19+ const apiKey = await getAPIKeyForProjectId ( project . id ) ;
2120
2221 if ( ! apiKey ) {
2322 notFound ( ) ;
You can’t perform that action at this time.
0 commit comments