Fix types
This commit is contained in:
parent
6b780e6865
commit
432f80f1a6
|
@ -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
|
||||||
|
|
|
@ -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 => ({
|
||||||
|
|
Loading…
Reference in New Issue