bug fixes: fix for application not working properly on lan
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
# Vue 3 + Vite
|
||||
# 🗳️ Election System - Frontend
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
This is the Vue.js 3 frontend for the Student Council Election system.
|
||||
|
||||
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
||||
## 🚀 Features
|
||||
- **Dynamic Voting Flow**: Interactive UI for casting ballots.
|
||||
- **Admin Dashboard**: Comprehensive management of candidates and results.
|
||||
- **Initial Setup UI**: Secure first-time configuration screen.
|
||||
- **Mobile Responsive**: Designed to work on tablets and smartphones at voting booths.
|
||||
|
||||
## 🛠️ Development
|
||||
### Install Dependencies
|
||||
```bash
|
||||
npm install -all
|
||||
```
|
||||
|
||||
### Run Dev Server
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
|
||||
|
||||
---
|
||||
For full system documentation, please refer to the [Root README](../README.md).
|
||||
|
||||
@@ -44,15 +44,19 @@ router.beforeEach(async (to, from, next) => {
|
||||
const { data } = await authService.checkStatus();
|
||||
isConfigured = data.configured;
|
||||
} catch (err) {
|
||||
console.error('Failed to check configuration status');
|
||||
console.error('Failed to check configuration status:', err);
|
||||
// If we can't reach the server, don't redirect to setup.
|
||||
// Instead, allow the navigation to proceed to the target page which will likely fail its own API calls,
|
||||
// providing a better error context than a forced setup screen.
|
||||
return next();
|
||||
}
|
||||
}
|
||||
|
||||
if (!isConfigured && to.name !== 'Setup') {
|
||||
if (isConfigured === false && to.name !== 'Setup') {
|
||||
return next('/setup');
|
||||
}
|
||||
|
||||
if (isConfigured && to.name === 'Setup') {
|
||||
if (isConfigured === true && to.name === 'Setup') {
|
||||
return next('/');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const API_URL = 'http://localhost:3000/api'; // Changed to localhost for testing
|
||||
const API_URL = `http://${window.location.hostname}:3000/api`;
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: API_URL,
|
||||
|
||||
Reference in New Issue
Block a user