@plutocms/supabase 0.0.1-alpha.4 → 0.0.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,11 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
2
2
|
if (to.path !== '/admin/setup' && to.path.startsWith('/admin')) {
|
|
3
3
|
try {
|
|
4
4
|
const data = await $fetch('/api/settings/first_setup')
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
if (!data.success) {
|
|
7
|
+
return navigateTo('/admin/setup')
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
if (
|
|
7
11
|
data.is_first_setup === true &&
|
|
8
12
|
from.path.startsWith('/admin') &&
|
|
@@ -10,7 +14,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
10
14
|
) {
|
|
11
15
|
return navigateTo('/admin/setup')
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
|
|
14
18
|
if (
|
|
15
19
|
data.is_first_setup === false &&
|
|
16
20
|
from.path.startsWith('/admin') &&
|
|
@@ -18,7 +22,11 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
18
22
|
) {
|
|
19
23
|
return navigateTo('/')
|
|
20
24
|
}
|
|
21
|
-
} catch(error) {
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (import.meta.dev) {
|
|
27
|
+
console.error('Error checking first setup status:', error)
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
return navigateTo('/admin/setup')
|
|
23
31
|
}
|
|
24
32
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ export default defineEventHandler(async (event) => {
|
|
|
10
10
|
|
|
11
11
|
if (error) {
|
|
12
12
|
return {
|
|
13
|
-
success: false,
|
|
13
|
+
success: false as const,
|
|
14
14
|
message: 'Error retrieving healthcheck settings',
|
|
15
15
|
error: error.message,
|
|
16
16
|
}
|
|
@@ -32,7 +32,7 @@ export default defineEventHandler(async (event) => {
|
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
|
-
success: true,
|
|
35
|
+
success: true as const,
|
|
36
36
|
message: 'Healthcheck settings retrieved successfully',
|
|
37
37
|
is_first_setup: isFirstSetup.first_setup === 'true',
|
|
38
38
|
}
|
|
@@ -30,9 +30,9 @@ export default defineEventHandler(async (event) => {
|
|
|
30
30
|
const sql = postgres(connectionString)
|
|
31
31
|
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
await sql.begin(async (sql) => {
|
|
34
34
|
await sql.unsafe(schema)
|
|
35
|
-
})
|
|
35
|
+
})
|
|
36
36
|
|
|
37
37
|
// Set the first_setup flag in the healthcheck table to false
|
|
38
38
|
await sql`
|