Fix types

This commit is contained in:
Adria Navarro 2025-01-13 11:59:30 +01:00
parent 6b780e6865
commit 432f80f1a6
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ export const patchAPI = (API: APIClient) => {
const fetchSelf = API.fetchSelf const fetchSelf = API.fetchSelf
API.fetchSelf = async () => { API.fetchSelf = async () => {
const user = await fetchSelf() const user = await fetchSelf()
if (user && user._id) { if (user && "_id" in user && user._id) {
if (user.roleId === "PUBLIC") { if (user.roleId === "PUBLIC") {
// Don't try to enrich a public user as it will 403 // Don't try to enrich a public user as it will 403
return user return user

View File

@ -13,7 +13,7 @@ export interface SelfEndpoints {
generateAPIKey: () => Promise<string | undefined> generateAPIKey: () => Promise<string | undefined>
fetchDeveloperInfo: () => Promise<FetchAPIKeyResponse> fetchDeveloperInfo: () => Promise<FetchAPIKeyResponse>
fetchBuilderSelf: () => Promise<GetGlobalSelfResponse> fetchBuilderSelf: () => Promise<GetGlobalSelfResponse>
fetchSelf: () => Promise<AppSelfResponse> fetchSelf: () => Promise<AppSelfResponse | null>
} }
export const buildSelfEndpoints = (API: BaseAPIClient): SelfEndpoints => ({ export const buildSelfEndpoints = (API: BaseAPIClient): SelfEndpoints => ({