Skip to content

Commit

Permalink
chore: structure_checks create and delete services added
Browse files Browse the repository at this point in the history
  • Loading branch information
tyboro2002 committed Mar 25, 2024
1 parent aced180 commit a6c92b8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions frontend/src/composables/services/structure_check.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Structure_check} from '@/types/Structure_check.ts';
import {ref} from 'vue';
import {endpoints} from '@/config/endpoints.ts';
import { get, getList } from '@/composables/services/helpers.ts';
import { get, getList, create, delete_id } from '@/composables/services/helpers.ts';
import { useToast } from 'primevue/usetoast';

export function useStructure_check() {
Expand All @@ -21,10 +21,23 @@ export function useStructure_check() {
console.log(structure_checks.value ? structure_checks.value.map((structure_check, index) => `Structure_check ${index + 1}: ${JSON.stringify(structure_check)}`) : 'Structure_check is null');
}

async function createStructure_check(structure_check_data: any, project_id: string) {
const endpoint = endpoints.structure_checks.byProject.replace('{project_id}', project_id);
create<Structure_check>(endpoint, structure_check_data, structure_check, Structure_check.fromJSON, toast);
}

async function deleteStructure_check(id: string) {
const endpoint = endpoints.structure_checks.retrieve.replace('{id}', id.toString());
delete_id<Structure_check>(endpoint, structure_check, Structure_check.fromJSON, toast);
}

return {
structure_checks,
structure_check,
getStructure_checkByID,
getStructure_checkByProject
getStructure_checkByProject,

createStructure_check,
deleteStructure_check
};
}

0 comments on commit a6c92b8

Please sign in to comment.