mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Fix app crashing (#8076)
* fix app not being able to access shared store * fix imports
This commit is contained in:
@@ -5,7 +5,7 @@ import { API_INJECT, STORES_INJECT } from '../constants';
|
||||
export function useStores(): Record<string, any> {
|
||||
const stores = inject<Record<string, any>>(STORES_INJECT);
|
||||
|
||||
if (!stores) throw new Error('[useStores]: This function has to be used inside a Directus extension.');
|
||||
if (!stores) throw new Error('[useStores]: The stores could not be found.');
|
||||
|
||||
return stores;
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export function useStores(): Record<string, any> {
|
||||
export function useApi(): AxiosInstance {
|
||||
const api = inject<AxiosInstance>(API_INJECT);
|
||||
|
||||
if (!api) throw new Error('[useApi]: This function has to be used inside a Directus extension.');
|
||||
if (!api) throw new Error('[useApi]: The api could not be found.');
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user