mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-31 06:56:39 +00:00
Remove rewrite if match is removed
This commit is contained in:
@@ -188,6 +188,8 @@ export async function updateTarget(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pathMatchTypeRemoved = parsedBody.data.pathMatchType === null;
|
||||||
|
|
||||||
const [updatedTarget] = await db
|
const [updatedTarget] = await db
|
||||||
.update(targets)
|
.update(targets)
|
||||||
.set({
|
.set({
|
||||||
@@ -200,8 +202,8 @@ export async function updateTarget(
|
|||||||
path: parsedBody.data.path,
|
path: parsedBody.data.path,
|
||||||
pathMatchType: parsedBody.data.pathMatchType,
|
pathMatchType: parsedBody.data.pathMatchType,
|
||||||
priority: parsedBody.data.priority,
|
priority: parsedBody.data.priority,
|
||||||
rewritePath: parsedBody.data.rewritePath,
|
rewritePath: pathMatchTypeRemoved ? null : parsedBody.data.rewritePath,
|
||||||
rewritePathType: parsedBody.data.rewritePathType
|
rewritePathType: pathMatchTypeRemoved ? null : parsedBody.data.rewritePathType
|
||||||
})
|
})
|
||||||
.where(eq(targets.targetId, targetId))
|
.where(eq(targets.targetId, targetId))
|
||||||
.returning();
|
.returning();
|
||||||
|
|||||||
Reference in New Issue
Block a user