forked from OpenNeo/impress
Skip loading alt styles until speciesId
is present
Before this change, when loading an outfit by ID, we'd send a request to `/species/null/alt-styles.json`, which would come back as a 404, oops lol
This commit is contained in:
parent
118ec6aa1a
commit
46dc4cf009
1 changed files with 2 additions and 1 deletions
|
@ -1,10 +1,11 @@
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
export function useAltStylesForSpecies(speciesId, options = {}) {
|
export function useAltStylesForSpecies(speciesId, options = {enabled = true}) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
...options,
|
...options,
|
||||||
queryKey: ["altStylesForSpecies", String(speciesId)],
|
queryKey: ["altStylesForSpecies", String(speciesId)],
|
||||||
queryFn: () => loadAltStylesForSpecies(speciesId),
|
queryFn: () => loadAltStylesForSpecies(speciesId),
|
||||||
|
enabled: options.enabled && speciesId != null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue