Last change
on this file since 57e58a3 was 57e58a3, checked in by ste08 <sjovanoska@…>, 4 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.9 KB
|
Line | |
---|
1 | <!DOCTYPE html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="UTF-8">
|
---|
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
---|
6 | <title>Admin Login</title>
|
---|
7 | <link rel="stylesheet" href="/css/main.css">
|
---|
8 | <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
|
---|
9 | <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
---|
10 | </head>
|
---|
11 | <body>
|
---|
12 |
|
---|
13 | <div class="login-container" id="app">
|
---|
14 | <h1>Admin Login</h1>
|
---|
15 | <form @submit.prevent="loginAdmin">
|
---|
16 | <div class="form-group">
|
---|
17 | <label for="username">Username</label>
|
---|
18 | <input type="text" id="username" v-model="username" required placeholder="Enter your username" />
|
---|
19 | </div>
|
---|
20 |
|
---|
21 | <div class="form-group">
|
---|
22 | <label for="password">Password</label>
|
---|
23 | <input type="password" id="password" v-model="password" required placeholder="Enter your password" />
|
---|
24 | </div>
|
---|
25 |
|
---|
26 | <button type="submit">Login</button>
|
---|
27 | </form>
|
---|
28 | </div>
|
---|
29 |
|
---|
30 | <script>
|
---|
31 | new Vue({
|
---|
32 | el: '#app',
|
---|
33 | data: {
|
---|
34 | username: '',
|
---|
35 | password: ''
|
---|
36 | },
|
---|
37 | methods: {
|
---|
38 | loginAdmin() {
|
---|
39 | // Create login data object
|
---|
40 | const loginData = {
|
---|
41 | username: this.username,
|
---|
42 | password: this.password
|
---|
43 | };
|
---|
44 |
|
---|
45 | // Send POST request to the backend for login
|
---|
46 | axios.post('http://localhost:8080/api/admin/login', loginData)
|
---|
47 | .then(response => {
|
---|
48 | alert('Login successful');
|
---|
49 | window.location.replace('/support-tickets');
|
---|
50 | })
|
---|
51 | .catch(error => {
|
---|
52 | const errorMessage = error.response ? error.response.data : 'An error occurred';
|
---|
53 | alert(errorMessage);
|
---|
54 | });
|
---|
55 | }
|
---|
56 | }
|
---|
57 | });
|
---|
58 | </script>
|
---|
59 |
|
---|
60 | </body>
|
---|
61 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.