Skip to content

Commit 7fcf322

Browse files
Merge pull request #481 from appwrite/fix-fetch-console-project
Ensure console requests include project header
2 parents d48bc96 + afe4dfa commit 7fcf322

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

src/routes/console/+layout.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { sdk } from '$lib/stores/sdk';
22
import type { LayoutLoad } from './$types';
33

44
export const load: LayoutLoad = async () => {
5-
const response = await fetch(`${sdk.forConsole.client.config.endpoint}/health/version`);
5+
const { endpoint, project } = sdk.forConsole.client.config;
6+
const response = await fetch(`${endpoint}/health/version`, {
7+
headers: {
8+
'X-Appwrite-Project': project
9+
}
10+
});
611
const data = await response.json();
712

813
return {

src/routes/console/project-[project]/overview/platforms/wizard/store.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ export const versions = cachedStore<
5656
>('versions', function ({ set }) {
5757
return {
5858
load: async () => {
59-
const { endpoint } = sdk.forConsole.client.config;
60-
const response = await fetch(`${endpoint}/../versions`);
59+
const { endpoint, project } = sdk.forConsole.client.config;
60+
const response = await fetch(`${endpoint}/../versions`, {
61+
headers: {
62+
'X-Appwrite-Project': project
63+
}
64+
});
6165
set(await response.json());
6266
}
6367
};

src/routes/console/project-[project]/settings/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'PATCH',
7575
new URL(sdk.forConsole.client.config.endpoint + path),
7676
{
77+
'X-Appwrite-Project': sdk.forConsole.client.config.project,
7778
'content-type': 'application/json'
7879
},
7980
{

src/routes/console/project-[project]/settings/transferProject.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
sdk.forConsole.client.config.endpoint + '/projects/' + $project.$id + '/team'
2121
),
2222
{
23+
'X-Appwrite-Project': sdk.forConsole.client.config.project,
2324
'content-type': 'application/json'
2425
},
2526
{

src/routes/register/invite/[slug]/+page.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@
5454
5555
async function invite() {
5656
try {
57-
const res = await fetch(`${sdk.forConsole.client.config.endpoint}/account/invite`, {
57+
const { endpoint, project } = sdk.forConsole.client.config;
58+
const res = await fetch(`${endpoint}/account/invite`, {
5859
method: 'POST',
5960
headers: {
61+
'X-Appwrite-Project': project,
6062
'Content-Type': 'application/json'
6163
},
6264
body: JSON.stringify({

0 commit comments

Comments
 (0)