Merge pull request #481 from appwrite/fix-fetch-console-project

Ensure console requests include project header
This commit is contained in:
Torsten Dittmann authored and GitHub committed 2023-07-26 14:45:48 +02:00
commit 7fcf322dd8
5 files changed
+17 -4

No files matched your search

+6 -1
View File
@@ -2,7 +2,12 @@ import { sdk } from '$lib/stores/sdk';
import type { LayoutLoad } from './$types';
export const load: LayoutLoad = async () => {
const response = await fetch(`${sdk.forConsole.client.config.endpoint}/health/version`);
const { endpoint, project } = sdk.forConsole.client.config;
const response = await fetch(`${endpoint}/health/version`, {
headers: {
'X-Appwrite-Project': project
}
});
const data = await response.json();
return {
@@ -56,8 +56,12 @@ export const versions = cachedStore<
>('versions', function ({ set }) {
return {
load: async () => {
const { endpoint } = sdk.forConsole.client.config;
const response = await fetch(`${endpoint}/../versions`);
const { endpoint, project } = sdk.forConsole.client.config;
const response = await fetch(`${endpoint}/../versions`, {
headers: {
'X-Appwrite-Project': project
}
});
set(await response.json());
}
};
@@ -74,6 +74,7 @@
'PATCH',
new URL(sdk.forConsole.client.config.endpoint + path),
{
'X-Appwrite-Project': sdk.forConsole.client.config.project,
'content-type': 'application/json'
},
{
@@ -20,6 +20,7 @@
sdk.forConsole.client.config.endpoint + '/projects/' + $project.$id + '/team'
),
{
'X-Appwrite-Project': sdk.forConsole.client.config.project,
'content-type': 'application/json'
},
{
@@ -54,9 +54,11 @@
async function invite() {
try {
const res = await fetch(`${sdk.forConsole.client.config.endpoint}/account/invite`, {
const { endpoint, project } = sdk.forConsole.client.config;
const res = await fetch(`${endpoint}/account/invite`, {
method: 'POST',
headers: {
'X-Appwrite-Project': project,
'Content-Type': 'application/json'
},
body: JSON.stringify({