Skip to content

Commit

Permalink
Add check in fetchFederalState
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper committed Nov 5, 2023
1 parent 314b606 commit abf1d03
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/store/schools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,18 @@ export default class SchoolsModule extends VuexModule {

@Action
async fetchFederalState(): Promise<void> {
// This check is an intermediate solution until the school API is completely migrated to v3,
// because the v3 API returns the school with populated federalState, but the v1 API does not.
// After migrating POST and PATCH to v3, the whole action can be removed.
if (typeof this.school.federalState === "object") {
return;
}

this.setLoading(true);
try {
const data = (
await $axios.get<FederalState>(
`/v1/federalStates/${this.school.federalState.id}`
`/v1/federalStates/${this.school.federalState}`
)
).data;

Expand Down

0 comments on commit abf1d03

Please sign in to comment.