Skip to content

Commit

Permalink
Fix resetting acl groups on switching active toggle (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
heisbrot authored Oct 7, 2024
1 parent a0c4520 commit c1fcada
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions src/contexts/RoutesProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const RoutesContext = React.createContext(
},
);

export default function RoutesProvider({ children }: Props) {
export default function RoutesProvider({ children }: Readonly<Props>) {
const routeRequest = useApiCall<Route>("/routes", true);
const { mutate } = useSWRConfig();

Expand All @@ -38,9 +38,7 @@ export default function RoutesProvider({ children }: Props) {

notify({
title: "Network " + route.network_id + "-" + route.network,
description: message
? message
: "The network route was successfully updated",
description: message ?? "The network route was successfully updated",
promise: routeRequest
.put(
{
Expand All @@ -56,7 +54,10 @@ export default function RoutesProvider({ children }: Props) {
metric: toUpdate.metric ?? route.metric ?? 9999,
masquerade: toUpdate.masquerade ?? route.masquerade ?? true,
groups: toUpdate.groups ?? route.groups ?? [],
access_control_groups: toUpdate.access_control_groups ?? undefined,
access_control_groups:
toUpdate.access_control_groups ??
route.access_control_groups ??
undefined,
},
`/${route.id}`,
)
Expand All @@ -75,9 +76,7 @@ export default function RoutesProvider({ children }: Props) {
) => {
notify({
title: "Network " + route.network_id + "-" + route.network,
description: message
? message
: "The network route was successfully created",
description: message ?? "The network route was successfully created",
promise: routeRequest
.post({
network_id: route.network_id,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/routes/RouteActiveCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Route } from "@/interfaces/Route";
type Props = {
route: Route;
};
export default function RouteActiveCell({ route }: Props) {
export default function RouteActiveCell({ route }: Readonly<Props>) {
const { updateRoute } = useRoutes();
const { mutate } = useSWRConfig();

Expand Down

0 comments on commit c1fcada

Please sign in to comment.