/vue3-composition-api-crud

sample vue project that uses fake json server to test and use the requests and data inside the crud

Primary LanguageVue

vue3-composition-api-crud

This template should help get you started developing with Vue 3 in Vite.

Recommended IDE Setup

To set up a Git hook on Windows that prompts you before pushing to the master branch (or any other branch you want to protect), you can create a pre-push hook. This hook will run before any push command and can be used to display a warning or even prevent the push unless you explicitly confirm it.

Here’s how to set it up:

Step 1: Navigate to Your Git Repository

Open your terminal (Command Prompt, Git Bash, or any terminal that you prefer) and navigate to your Git repository:

cd path/to/your/repository

Step 2: Create the Pre-Push Hook

In your Git repository, navigate to the .git/hooks directory:

cd .git/hooks

Create a new file named pre-push (without any extension). You can do this using any text editor or the terminal:

touch pre-push

Step 3: Edit the Pre-Push Hook Script

Open the pre-push file in your favorite text editor and add the following script:

#!/bin/bash
# Get the name of the branch you are pushing to
current_branch=$(git rev-parse --abbrev-ref HEAD)

# Check if the branch is 'master'
if [ "$current_branch" == "master" ]; then
    echo "You are about to push to the master branch."
    read -p "Are you sure you want to continue? (yes/no): " choice
    if [ "$choice" != "yes" ]; then
        echo "Push aborted."
        exit 1
    fi
fi

# Allow the push to proceed
exit 0

Step 4: Make the Script Executable

Ensure the script is executable by running the following command:

chmod +x .git/hooks/pre-push

Step 5: Test the Hook

Now, when you try to push to the master branch, the hook will trigger and prompt you for confirmation. If you type yes, the push will proceed. If you type anything else, the push will be aborted.

Example Workflow

  1. You make some changes to your code.

  2. You commit those changes.

  3. You attempt to push to master:

    git push origin master
  4. You will see the prompt:

    You are about to push to the master branch.
    Are you sure you want to continue? (yes/no):
    
  5. If you type yes, the push proceeds. If you type no, the push is aborted.

This simple hook script ensures that you always get a warning before pushing changes directly to master, helping you avoid accidental updates.


Making request to the server, getting the data and displaying it in the UI by using loops

What I thing that should be added in this project :

  • Auth system : User should be logged in to using an API auth or firebase auth to view his data
  • Roles and permissions : All users will be assigned a particular role like admin, customer, enable them to view their own data
  • More user friendly errors, warnings, success messages : We will vue-toastification package for success messages or error messages, and for prompts we will use swal
  • Appearance and design : The design will be more nice and user friendly, it will look like a whole new application and create its pages like home, contact, view, map, privacy policy etc
  • the students data will not be json-server : The database will not be json server, we will use firebase or mongodb for this purpose

Youtube Video I'm watching to build this project | Geeks for Geeks