mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #481 from appwrite/fix-fetch-console-project
Ensure console requests include project header
This commit is contained in:
5 files changed
+17
-4
No files matched your search
@@ -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({
|
||||
|
||||
Reference in new issue
Block a user