Changeset a520992


Ignore:
Timestamp:
01/24/25 20:08:37 (3 months ago)
Author:
Ljubomir Ilievski <ilievski.ljubomir@…>
Branches:
master
Children:
17bf12d
Parents:
17db9d2
Message:

Izmenet register so fetch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ReserveNGo-frontend/src/components/Project/register_.vue

    r17db9d2 ra520992  
    77      path: '',
    88      url: 'http://localhost:8080/api/auth/register/',
     9      form_info:{
     10        firstName: '',
     11        lastName: '',
     12        email: '',
     13        password: '',
     14        phoneNumber: '',
     15
     16      },
     17      data: {}
    918
    1019    }
     
    1221
    1322  methods: {
     23    register() {
     24      fetch(this.url+this.path, {
     25        method: 'POST',
     26        headers: { "Content-Type": "application/json" },
     27        body: JSON.stringify({firstName: this.firstName, lastName: this.lastName, email: this.email, password: this.password})
     28      }).then((response) => {response.json()})
     29        .then((json) => this.data = json)
     30
     31    }
    1432
    1533  },
     
    3351
    3452  <div class="col-3">
    35     <form v-bind:action="url+path" method="POST">
     53    <form @submit.prevent="register()" method="POST">
    3654      <label for="name" class="form-label" >Name</label>
    37       <input type="text" id="name" name="firstName" class="form-control" placeholder="Name" required>
     55      <input v-model="form_info.firstName" type="text" id="name" name="firstName" class="form-control" placeholder="Name" required>
    3856
    3957      <label for="surname" class="form-label">Surname</label>
    40       <input type="text" id="surname" name="lastName" class="form-control" placeholder="Surname" required>
     58      <input v-model="form_info.lastName" type="text" id="surname" name="lastName" class="form-control" placeholder="Surname" required>
    4159
    4260      <label for="phone_number" class="form-label">Phone Number</label>
    43       <input type="text" id="phone_number" name="phoneNumber" class="form-control" required>
     61      <input v-model="form_info.phoneNumber" type="text" id="phone_number" name="phoneNumber" class="form-control" required>
    4462
    4563      <label for="email" class="form-label">Email Address</label>
    46       <input type="email" id="email" name="email" class="form-control" placeholder="someone@example.com" required>
     64      <input v-model="form_info.email" type="email" id="email" name="email" class="form-control" placeholder="someone@example.com" required>
    4765
    4866      <label for="password" class="form-label">Password</label>
    49       <input type="password" id="password" name="password" class="form-control">
     67      <input v-model="form_info.password" type="password" id="password" name="password" class="form-control">
    5068
    5169      <label for="role" class="form-label">Role</label>
Note: See TracChangeset for help on using the changeset viewer.