fix(api): fixes
This commit is contained in:
@@ -21,8 +21,7 @@
|
|||||||
"vue": "^3.5.25",
|
"vue": "^3.5.25",
|
||||||
"vue-router": "^4.6.3",
|
"vue-router": "^4.6.3",
|
||||||
"tsparticles": "~3.9.1",
|
"tsparticles": "~3.9.1",
|
||||||
"@tsparticles/vue3": "~3.0.1",
|
"@tsparticles/vue3": "~3.0.1"
|
||||||
"vuejs-ajax": "^1.4.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@quasar/vite-plugin": "^1.10.0",
|
"@quasar/vite-plugin": "^1.10.0",
|
||||||
|
|||||||
BIN
public/logo.png
Normal file
BIN
public/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
12
src/main.ts
12
src/main.ts
@@ -5,10 +5,22 @@ import App from './App.vue'
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import Particles from "@tsparticles/vue3";
|
import Particles from "@tsparticles/vue3";
|
||||||
import { loadFull } from "tsparticles";
|
import { loadFull } from "tsparticles";
|
||||||
|
import { Quasar, Notify } from 'quasar'
|
||||||
|
import '@quasar/extras/material-icons/material-icons.css'
|
||||||
|
import 'quasar/dist/quasar.css'
|
||||||
|
|
||||||
|
import axios from 'axios'
|
||||||
|
import VueAxios from 'vue-axios'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
|
app.use(Quasar, {
|
||||||
|
plugins: {
|
||||||
|
Notify
|
||||||
|
},
|
||||||
|
})
|
||||||
|
app.use(VueAxios, axios)
|
||||||
app.use(Particles, {
|
app.use(Particles, {
|
||||||
init: async engine => {
|
init: async engine => {
|
||||||
await loadFull(engine);
|
await loadFull(engine);
|
||||||
|
|||||||
@@ -1,5 +1,87 @@
|
|||||||
|
<template>
|
||||||
|
<div class="login-box q-col-gutter-sm">
|
||||||
|
<div class="text-h3 text-center row">
|
||||||
|
<img src="/logo.png" alt="Logo" style="height: 60px; margin-right: 10px;" />
|
||||||
|
</div>
|
||||||
|
<q-form @submit.prevent="onSubmit"
|
||||||
|
class="q-gutter-md row justify-center"
|
||||||
|
style="width: 100%">
|
||||||
|
|
||||||
|
<div class="row q-col-gutter-sm" style="width: 100%">
|
||||||
|
<q-input
|
||||||
|
style="width: 100%"
|
||||||
|
filled
|
||||||
|
dark
|
||||||
|
label-color="white"
|
||||||
|
color="white"
|
||||||
|
v-model="username"
|
||||||
|
label="Username *"
|
||||||
|
lazy-rules
|
||||||
|
:rules="[ val => val && val.length > 0 || 'Username is required']"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row q-col-gutter-sm" style="width: 100%">
|
||||||
|
<q-input
|
||||||
|
style="width: 100%"
|
||||||
|
filled
|
||||||
|
dark
|
||||||
|
label-color="white"
|
||||||
|
color="white"
|
||||||
|
v-model="password"
|
||||||
|
label="Password *"
|
||||||
|
lazy-rules
|
||||||
|
:rules="[
|
||||||
|
val => !!val || 'Password is required'
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row justify-center">
|
||||||
|
<q-btn type="submit" label="Login" push color="dark" />
|
||||||
|
</div>
|
||||||
|
</q-form>
|
||||||
|
</div>
|
||||||
|
<vue-particles
|
||||||
|
id="particles-js"
|
||||||
|
:options='options'
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
||||||
|
import { useQuasar } from 'quasar'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import 'vuejs-ajax'
|
||||||
|
import axios from "axios";
|
||||||
|
const api = window?.__RUNTIME_CONFIG__?.API_URL;
|
||||||
|
|
||||||
|
const $q = useQuasar()
|
||||||
|
|
||||||
|
const username = ref(null)
|
||||||
|
const password = ref(null)
|
||||||
|
let error = ref(false)
|
||||||
|
let inProgress = ref(false)
|
||||||
|
|
||||||
|
const onSubmit = () => {
|
||||||
|
if (inProgress.value) return
|
||||||
|
inProgress.value = true
|
||||||
|
axios.post(`${api}/login`, {username: username.value, password: password.value}).then(response => {
|
||||||
|
$q.notify({
|
||||||
|
message: 'Login successful',
|
||||||
|
color: 'positive'
|
||||||
|
})
|
||||||
|
window.location.href = '/'
|
||||||
|
}).catch(error => {
|
||||||
|
$q.notify({
|
||||||
|
message: error.response?.data?.message || 'Login failed',
|
||||||
|
color: 'negative'
|
||||||
|
})
|
||||||
|
}).finally(() =>
|
||||||
|
inProgress.value = false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
"particles": {
|
"particles": {
|
||||||
"number": {
|
"number": {
|
||||||
@@ -116,16 +198,6 @@ const options = {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="login-box">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<vue-particles
|
|
||||||
id="particles-js"
|
|
||||||
:options='options'
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.login-box {
|
.login-box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -139,5 +211,7 @@ const options = {
|
|||||||
max-width: 420px;
|
max-width: 420px;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
background-color: var(--color-background);
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ import { fileURLToPath, URL } from 'node:url'
|
|||||||
|
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue({ template: { transformAssetUrls } }),
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
vueDevTools(),
|
vueDevTools(),
|
||||||
|
quasar(),
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|||||||
Reference in New Issue
Block a user