Skip to content

Commit

Permalink
Service object updates (#88)
Browse files Browse the repository at this point in the history
* remove barrel file for api service layer

* update return signatures for clarity in api service layer

* remove references to barrel file
  • Loading branch information
nevinsm authored Sep 19, 2024
1 parent 3936b96 commit 022f26f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 24 deletions.
10 changes: 5 additions & 5 deletions resources/js/api/ConceptService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const apiClient = axios.create({
baseURL: `api/concepts`,
baseURL: `/api/concepts`,
});

export default {
Expand All @@ -17,7 +17,7 @@ export default {
});
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -26,7 +26,7 @@ export default {
const { data } = await apiClient.get(`/${conceptId}`);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -35,7 +35,7 @@ export default {
const { data } = await apiClient.post('', conceptData);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -44,7 +44,7 @@ export default {
const { data } = await apiClient.delete(`/${conceptId}`);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},
};
12 changes: 6 additions & 6 deletions resources/js/api/ConceptSourceService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const apiClient = axios.create({
baseURL: `api/concept_sources`,
baseURL: `/api/concept_sources`,
});

export default {
Expand All @@ -17,7 +17,7 @@ export default {
});
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -26,7 +26,7 @@ export default {
const { data } = await apiClient.get(`/${conceptSourceId}`);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -35,7 +35,7 @@ export default {
const { data } = await apiClient.post('', conceptSourceData);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -47,7 +47,7 @@ export default {
);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -56,7 +56,7 @@ export default {
const { data } = await apiClient.delete(`/${conceptSourceId}`);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},
};
12 changes: 6 additions & 6 deletions resources/js/api/TermService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const apiClient = axios.create({
baseURL: `api/terms`,
baseURL: `/api/terms`,
});

export default {
Expand All @@ -17,7 +17,7 @@ export default {
});
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -26,7 +26,7 @@ export default {
const { data } = await apiClient.get(`/${termId}`);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -35,7 +35,7 @@ export default {
const { data } = await apiClient.post('', termData);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -44,7 +44,7 @@ export default {
const { data } = await apiClient.patch(`/${termId}`, termData);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},

Expand All @@ -53,7 +53,7 @@ export default {
const { data } = await apiClient.delete(`/${termId}`);
return [null, data];
} catch (error) {
return [error];
return [error, null];
}
},
};
5 changes: 0 additions & 5 deletions resources/js/api/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion resources/js/components/Concept/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import {
BFormInvalidFeedback,
} from 'bootstrap-vue';
import { categories } from '../../config/catgegories';
import { ConceptService } from '../../api';
import ConceptService from '../../api/ConceptService';
export default {
data() {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/Concept/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import {
BPagination,
BTable,
} from 'bootstrap-vue';
import { ConceptService } from '../../api';
import ConceptService from '../../api/ConceptService';
import { sortBy } from 'lodash';
export default {
Expand Down

0 comments on commit 022f26f

Please sign in to comment.