Skip to content

Commit

Permalink
Include the custom locations in spool edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed Nov 24, 2024
1 parent 0827cc8 commit d142b0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/src/pages/spools/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { numberFormatter, numberParser } from "../../utils/parsing";
import { EntityType, useGetFields } from "../../utils/queryFields";
import { getCurrencySymbol, useCurrency } from "../../utils/settings";
import { createFilamentFromExternal } from "../filaments/functions";
import { useLocations } from "../locations/functions";
import { useGetFilamentSelectOptions } from "./functions";
import { ISpool, ISpoolParsedExtras, WeightToEnter } from "./model";

Expand Down Expand Up @@ -148,9 +149,15 @@ export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
};

const locations = useSpoolmanLocations(true);
const settingsLocation = useLocations();
const [newLocation, setNewLocation] = useState("");

const allLocations = [...(locations.data || [])];
const allLocations = [...(settingsLocation || [])];
locations?.data?.forEach((loc) => {
if (!allLocations.includes(loc)) {
allLocations.push(loc);
}
});
if (newLocation.trim() && !allLocations.includes(newLocation)) {
allLocations.push(newLocation.trim());
}
Expand Down

0 comments on commit d142b0e

Please sign in to comment.