Skip to content

Commit

Permalink
🔨 bug fixes
Browse files Browse the repository at this point in the history
closes #160
closes #159
  • Loading branch information
casperiv0 committed Nov 21, 2021
1 parent 071e6c7 commit 3105354
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions packages/client/src/components/dispatch/ActiveOfficers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ export const ActiveOfficers = () => {
}

async function handleunMerge(id: string) {
await execute(`/dispatch/status/unmerge/${id}`, {
const { json } = await execute(`/dispatch/status/unmerge/${id}`, {
data: { id },
method: "POST",
});

if (json) {
router.replace({
pathname: router.pathname,
query: router.query,
});
}
}

async function setCode(id: string, status: StatusValue) {
Expand Down Expand Up @@ -97,7 +104,10 @@ export const ActiveOfficers = () => {
const canBeOpened =
isDispatch ||
shouldShowSplit ||
(activeOfficer && activeOfficer.id !== officer.id);
(activeOfficer &&
activeOfficer.id !== officer.id &&
!("officers" in officer) &&
!("officers" in activeOfficer));

const codesMapped = codes10.values
.filter((v) => v.type === "STATUS_CODE")
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type PermissionRoute = [Method[] | "*", string | RegExp, (user: _User) =>

export const PERMISSION_ROUTES: PermissionRoute[] = [
[["POST"], "/v1/dispatch/status/merge", (u) => u.isLeo],
[["POST"], "/v1/dispatch/status/unmerge", (u) => u.isDispatch],
[["POST"], "/v1/dispatch/status/unmerge", (u) => u.isDispatch || u.isLeo],
[
"*",
/\/v1\/dispatch\/status\/\w+/i,
Expand Down

0 comments on commit 3105354

Please sign in to comment.