Skip to content

Commit

Permalink
Merge pull request #1340 from hinashi/fixed/job_cancel_error
Browse files Browse the repository at this point in the history
Fixed not being able to cancel a job from the Job menu
  • Loading branch information
userlocalhost authored Dec 18, 2024
2 parents 6f1bf34 + 6b8c0a8 commit 6c425a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions frontend/src/components/job/JobList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Typography,
} from "@mui/material";
import { styled } from "@mui/material/styles";
import { useSnackbar } from "notistack";
import React, { FC, useState } from "react";
import { Link, useNavigate } from "react-router-dom";

Expand Down Expand Up @@ -108,6 +109,7 @@ interface Props {

export const JobList: FC<Props> = ({ jobs }) => {
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();

const [encodes, setEncodes] = useState<{
[key: number]: string;
Expand All @@ -119,8 +121,14 @@ export const JobList: FC<Props> = ({ jobs }) => {
};

const handleCancel = async (jobId: number) => {
await aironeApiClient.cancelJob(jobId);
navigate(0);
await aironeApiClient
.cancelJob(jobId)
.then(() => {
navigate(0);
})
.catch(() => {
enqueueSnackbar("キャンセルに失敗しました。", { variant: "error" });
});
};

return (
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c425a9

Please sign in to comment.