Skip to content

Commit 6f190cd

Browse files
committed
Added link to API Explorer
1 parent 75d2e3c commit 6f190cd

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ REDIS_PORT="6379"
3838
# UI Configuration
3939
PUBLIC_LOGO_URL="/logo2x-1.png"
4040
PUBLIC_DARK_LOGO_URL="/obp_logo.svg"
41+
42+
# Links for documentation and for other reasons. No default
43+
API_EXPLORER_URL=http://localhost:5173

src/routes/(protected)/dynamic-entities/system/create/+page.server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { PageServerLoad } from "./$types";
22
import { error } from "@sveltejs/kit";
33
import { SessionOAuthHelper } from "$lib/oauth/sessionHelper";
44

5-
export const load: PageServerLoad = async ({ locals }) => {
5+
export const load: PageServerLoad = async ({ locals, parent }) => {
66
const session = locals.session;
77

88
if (!session?.data?.user) {
@@ -16,5 +16,10 @@ export const load: PageServerLoad = async ({ locals }) => {
1616
throw error(401, "No API access token available");
1717
}
1818

19-
return {};
19+
// Get parent layout data to access externalLinks
20+
const parentData = await parent();
21+
22+
return {
23+
externalLinks: parentData.externalLinks || {},
24+
};
2025
};

src/routes/(protected)/dynamic-entities/system/create/+page.svelte

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<script lang="ts">
22
import { goto } from "$app/navigation";
3+
import type { PageData } from "./$types";
34
import {
45
extractErrorFromResponse,
56
formatErrorForDisplay,
67
logErrorDetails,
78
} from "$lib/utils/errorHandler";
89
10+
let { data }: { data: PageData } = $props();
11+
912
let entityName = $state("");
1013
let entityDescription = $state("");
1114
let schemaJson = $state(`{
@@ -239,6 +242,32 @@
239242
<strong>example:</strong> Example value for the field (optional)
240243
</li>
241244
</ul>
245+
{#if data.externalLinks?.API_EXPLORER_URL}
246+
<div class="mt-3 border-t border-blue-300 pt-3 dark:border-blue-700">
247+
<a
248+
href="{data.externalLinks
249+
.API_EXPLORER_URL}/resource-docs/OBPv6.0.0?operationid=OBPv4.0.0-createSystemDynamicEntity"
250+
target="_blank"
251+
rel="noopener noreferrer"
252+
class="inline-flex items-center text-xs font-medium text-blue-700 hover:text-blue-900 hover:underline dark:text-blue-300 dark:hover:text-blue-100"
253+
>
254+
View API Documentation on API Explorer
255+
<svg
256+
class="ml-1 h-4 w-4"
257+
fill="none"
258+
stroke="currentColor"
259+
viewBox="0 0 24 24"
260+
>
261+
<path
262+
stroke-linecap="round"
263+
stroke-linejoin="round"
264+
stroke-width="2"
265+
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
266+
/>
267+
</svg>
268+
</a>
269+
</div>
270+
{/if}
242271
</div>
243272

244273
<!-- Actions -->

src/routes/+layout.server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export async function load(event: RequestEvent) {
2828
let data: Partial<RootLayoutData> = {};
2929

3030
let externalLinks = {
31-
API_EXPLORER_URL: env.API_EXPLORER_URL,
31+
API_EXPLORER_URL:
32+
env.API_EXPLORER_URL ||
33+
"https://apiexplorer-ii-sandbox.openbankproject.com",
3234
API_MANAGER_URL: env.API_MANAGER_URL,
3335
SUBSCRIPTIONS_URL: publicEnv.PUBLIC_SUBSCRIPTIONS_URL,
3436
LEGACY_PORTAL_URL: publicEnv.PUBLIC_LEGACY_PORTAL_URL,

0 commit comments

Comments
 (0)