user permissions

This commit is contained in:
2025-07-19 13:38:58 +02:00
parent ec8e73507c
commit 496d5bdb2b
30 changed files with 1384 additions and 195 deletions

View File

@@ -11,5 +11,7 @@ export function getApiHeaders(
}
}
headers['content-type'] = 'application/json';
return headers;
}

View File

@@ -34,9 +34,7 @@ export async function getWarrenDirectory(
ApiResponse<{ files: DirectoryEntry[] }>
>(getApiUrl(`warrens/files`), {
method: 'POST',
headers: {
'content-type': 'application/json',
},
headers: getApiHeaders(),
body: JSON.stringify({
warrenId,
path,
@@ -65,9 +63,7 @@ export async function createDirectory(
const { status } = await useFetch(getApiUrl(`warrens/files/directory`), {
method: 'POST',
headers: {
'content-type': 'application/json',
},
headers: getApiHeaders(),
body: JSON.stringify({
warrenId,
path,
@@ -106,9 +102,7 @@ export async function deleteWarrenDirectory(
const { status } = await useFetch(getApiUrl(`warrens/files/directory`), {
method: 'DELETE',
headers: {
'content-type': 'application/json',
},
headers: getApiHeaders(),
body: JSON.stringify({
warrenId,
path,
@@ -148,9 +142,7 @@ export async function deleteWarrenFile(
const { status } = await useFetch(getApiUrl(`warrens/files/file`), {
method: 'DELETE',
headers: {
'content-type': 'application/json',
},
headers: getApiHeaders(),
body: JSON.stringify({
warrenId,
path,
@@ -209,6 +201,11 @@ export async function uploadToWarren(
body.append('files', file);
}
const headers = getApiHeaders();
for (const [key, value] of Object.entries(headers)) {
xhr.setRequestHeader(key, value);
}
xhr.send(body);
try {
@@ -244,9 +241,7 @@ export async function renameWarrenEntry(
const { status } = await useFetch(getApiUrl(`warrens/files/rename`), {
method: 'PATCH',
headers: {
'content-type': 'application/json',
},
headers: getApiHeaders(),
body: JSON.stringify({
warrenId,
path,

View File

@@ -21,7 +21,7 @@ export const useWarrenStore = defineStore('warrens', {
}
if (!this.current.path.endsWith('/')) {
this.current.path += '/';
path = '/' + path;
}
this.current.path += path;