Skip to content

Commit 16382a4

Browse files
committed
fix: use projectKey
1 parent 77116ca commit 16382a4

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

_demo/.nuxtrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

modules/hub/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export interface ModuleOptions {
2222
*/
2323
url?: string
2424
/**
25-
* The ID of the project on the NuxtHub platform
25+
* The project's key on the NuxtHub platform
2626
* Available when using the NuxtHub platform using `nuxthub link`
27-
* @default process.env.NUXT_HUB_PROJECT_ID
27+
* @default process.env.NUXT_HUB_PROJECT_KEY
2828
*/
29-
projectId?: string
29+
projectKey?: string
3030
/**
3131
* The user token to access the NuxtHub platform
3232
* Available when using the NuxtHub platform using `nuxthub login`
@@ -68,7 +68,7 @@ export default defineNuxtModule<ModuleOptions>({
6868
const runtimeConfig = nuxt.options.runtimeConfig
6969
const hub = runtimeConfig.hub = defu(runtimeConfig.hub, options, {
7070
url: process.env.NUXT_HUB_URL || 'https://hub.nuxt.com',
71-
projectId: process.env.NUXT_HUB_PROJECT_ID || '',
71+
projectKey: process.env.NUXT_HUB_PROJECT_KEY || '',
7272
projectUrl: process.env.NUXT_HUB_PROJECT_URL || '',
7373
projectSecretKey: process.env.NUXT_HUB_PROJECT_SECRET_KEY || '',
7474
userToken: process.env.NUXT_HUB_USER_TOKEN || '',
@@ -80,8 +80,8 @@ export default defineNuxtModule<ModuleOptions>({
8080
}
8181

8282
// Check if the project is linked to a NuxtHub project
83-
if (!hub.local && hub.projectId && /^\d+$/.test(String(hub.projectId))) {
84-
const project = await $fetch(`/api/projects/${hub.projectId}`, {
83+
if (!hub.local && hub.projectKey) {
84+
const project = await $fetch(`/api/projects/${hub.projectKey}`, {
8585
baseURL: hub.url,
8686
headers: {
8787
authorization: `Bearer ${hub.userToken}`

server/middleware/1.hub-auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export default eventHandler(async (event) => {
2727
}
2828

2929
// Hosted on NuxtHub
30-
if (hub.projectId && /^\d+$/.test(String(hub.projectId))) {
30+
if (hub.projectKey) {
3131
// Here the secretKey is a user token
32-
await $fetch(`/api/projects/${hub.projectId}`, {
32+
await $fetch(`/api/projects/${hub.projectKey}`, {
3333
baseURL: hub.url,
3434
method: 'HEAD',
3535
headers: {

0 commit comments

Comments
 (0)