Skip to content

Commit

Permalink
Check if corpus deletion succeeds, fix #140
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Jan 4, 2024
1 parent 6101f62 commit 88e0de0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ As this project is a user-facing application, the places in the semantic version
- `RouteButton` component replaces `router-link > ActionButton`
- `ActionButton` uses `<button>` and is tabbable

### Fixed

- Error handling when deleting corpus

### Removed

- `useVariant`
Expand Down
6 changes: 5 additions & 1 deletion src/corpus/CorpusDelete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import RouteButton from "@/components/RouteButton.vue";
import Section from "@/components/Section.vue";
import PendingContent from "@/spin/PendingContent.vue";
import useCorpus from "./corpus.composable";
import { useCorpusStore } from "@/store/corpus.store";
const router = useRouter();
const corpusId = useCorpusIdParam();
const { deleteCorpus } = useCorpus(corpusId);
const corpusStore = useCorpusStore();
async function doDelete() {
await deleteCorpus();
router.push("/corpus");
if (!(corpusId in corpusStore.corpora)) {
router.push("/corpus");
}
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions src/corpus/corpus.composable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function useCorpus(corpusId) {
const corpusStore = useCorpusStore();
const { refreshJwt } = useAuth();
const mink = useMinkBackend();
const { loadCorpora } = useCorpora();
const { loadCorpora, refreshCorpora } = useCorpora();
const { alertError } = useMessenger();
const { loadConfig } = useConfig(corpusId);

Expand All @@ -39,7 +39,7 @@ export default function useCorpus(corpusId) {
// The backend will have updated the remote JWT, so refresh our copy.
// The backend uses the corpus list within it when listing available corpora.
await refreshJwt();
corpusStore.removeCorpus(corpusId_);
await refreshCorpora();
}

return { loadCorpus, deleteCorpus };
Expand Down

0 comments on commit 88e0de0

Please sign in to comment.