Skip to content

Commit

Permalink
Merge pull request #4 from IntelliSOFT-Consulting/chore/clean-up
Browse files Browse the repository at this point in the history
Chore/clean up
  • Loading branch information
PiusKariuki authored Oct 2, 2024
2 parents 9db6a49 + c37882e commit a5ea4ae
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/modules/facilities/hooks/useRegisterProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,34 @@ export const useRegisterProvider = () => {

const toast = useToast();

const {makeNormalRequest, error} = useAxios();
const {makeNormalRequest} = useAxios();

const resetState = () => {
state.idNumber = "";
state.email = "";
state.role = "";
state.firstName = "";
state.lastName = "";
state.facility = "";
state.phone = "";
state.password = "";
state.confirmPassword = "";
};


const handleSubmit = async(e) => {
e.preventDefault();
try{
loading.value = true;
const response = await makeNormalRequest({
await makeNormalRequest({
method: "POST",
url: "auth/provider/register",
data: {
...state
}
})
resetState();
toast.success("Register successfully.");
} catch (e){
toast.error(e)
return e;
Expand Down

0 comments on commit a5ea4ae

Please sign in to comment.