Merge branch 'release/0.19' into feat/advanced-permissions

This commit is contained in:
dswbx
2025-10-24 15:15:56 +02:00
committed by GitHub
32 changed files with 587 additions and 107 deletions

View File

@@ -53,9 +53,7 @@ export const ClientProvider = ({
[JSON.stringify(apiProps)],
);
const [authState, setAuthState] = useState<Partial<AuthState> | undefined>(
apiProps.user ? api.getAuthState() : undefined,
);
const [authState, setAuthState] = useState<Partial<AuthState> | undefined>(api.getAuthState());
return (
<ClientContext.Provider value={{ baseUrl: api.baseUrl, api, authState }}>

View File

@@ -16,8 +16,8 @@ type UseAuth = {
verified: boolean;
login: (data: LoginData) => Promise<AuthResponse>;
register: (data: LoginData) => Promise<AuthResponse>;
logout: () => void;
verify: () => void;
logout: () => Promise<void>;
verify: () => Promise<void>;
setToken: (token: string) => void;
};
@@ -42,12 +42,13 @@ export const useAuth = (options?: { baseUrl?: string }): UseAuth => {
}
async function logout() {
api.updateToken(undefined);
invalidate();
await api.auth.logout();
await invalidate();
}
async function verify() {
await api.verifyAuth();
await invalidate();
}
return {

View File

@@ -9,8 +9,8 @@ import {
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { isFileAccepted } from "bknd/utils";
import { type FileWithPath, useDropzone } from "./use-dropzone";
import { checkMaxReached } from "./helper";
import { DropzoneInner } from "./DropzoneInner";
@@ -173,12 +173,14 @@ export function Dropzone({
return specs.every((spec) => {
if (spec.kind !== "file") {
console.log("not a file", spec.kind);
console.warn("file not accepted: not a file", spec.kind);
return false;
}
if (allowedMimeTypes && allowedMimeTypes.length > 0) {
console.log("not allowed mimetype", spec.type);
return allowedMimeTypes.includes(spec.type);
if (!isFileAccepted(i, allowedMimeTypes)) {
console.warn("file not accepted: not allowed mimetype", spec.type);
return false;
}
}
return true;
});

View File

@@ -95,7 +95,7 @@ export function useNavigate() {
window.location.href = url;
return;
} else if ("target" in options) {
const _url = window.location.origin + basepath + router.base + url;
const _url = window.location.origin + router.base + url;
window.open(_url, options.target);
return;
}

View File

@@ -215,7 +215,9 @@ const EntityContextMenu = ({
href && {
icon: IconExternalLink,
label: "Open in tab",
onClick: () => navigate(href, { target: "_blank" }),
onClick: () => {
navigate(href, { target: "_blank", absolute: true });
},
},
separator,
!$data.system(entity.name).any && {