Rewind from a user account system. Not necessary.
This commit is contained in:
parent
640f81a79f
commit
0ea172d6ad
22 changed files with 8 additions and 3032 deletions
45
src/App.vue
45
src/App.vue
|
@ -2,10 +2,6 @@
|
|||
import { RouterLink, RouterView } from 'vue-router';
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
// Authentication state
|
||||
const isAuthenticated = ref(false);
|
||||
const username = ref("");
|
||||
|
||||
// Theme state and available themes
|
||||
const theme = ref(localStorage.getItem("theme") || "mocha");
|
||||
const availableThemes = [
|
||||
|
@ -23,24 +19,11 @@ const availableThemes = [
|
|||
"daydreamer",
|
||||
];
|
||||
|
||||
// Apply theme and check authentication state
|
||||
// Apply theme
|
||||
onMounted(() => {
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
isAuthenticated.value = true;
|
||||
username.value = localStorage.getItem("username") || "";
|
||||
}
|
||||
document.documentElement.setAttribute("data-theme", theme.value);
|
||||
});
|
||||
|
||||
// Logout function
|
||||
const logout = () => {
|
||||
localStorage.removeItem("token");
|
||||
localStorage.removeItem("username");
|
||||
isAuthenticated.value = false;
|
||||
window.location.href = "/";
|
||||
};
|
||||
|
||||
// Change theme function
|
||||
const changeTheme = (newTheme: string) => {
|
||||
theme.value = newTheme;
|
||||
|
@ -57,37 +40,21 @@ const changeTheme = (newTheme: string) => {
|
|||
<div class="nav-links">
|
||||
<RouterLink to="/">Home</RouterLink>
|
||||
<RouterLink to="/servers">Servers</RouterLink>
|
||||
<RouterLink to="/projects">Projects</RouterLink>
|
||||
<RouterLink v-if="isAuthenticated" to="/recipes">Recipes</RouterLink>
|
||||
<RouterLink v-if="isAuthenticated" to="/calendar">Calendar</RouterLink>
|
||||
<RouterLink v-if="isAuthenticated" to="/gallery">Gallery</RouterLink>
|
||||
<RouterLink to="/projects">Projects</RouterLink>"
|
||||
<a href="https://foundryvtt.example.com" target="_blank">Foundry VTT</a>
|
||||
<a href="https://oekaki.smgames.club" target="_blank">Oekaki</a>
|
||||
<a href="https://social.smgames.club/" target="_blank">Social</a>
|
||||
<a href="https://madstar.studio" target="_blank">Shop</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- Authentication & Theme Controls -->
|
||||
<section class="controls">
|
||||
<div class="theme-selector">
|
||||
<!-- Theme Selector -->
|
||||
<div class="theme-selector">
|
||||
<label for="theme-switcher">Theme:</label>
|
||||
<select id="theme-switcher" v-model="theme" @change="changeTheme(theme)">
|
||||
<option v-for="t in availableThemes" :key="t" :value="t">{{ t }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="auth-controls">
|
||||
<span v-if="isAuthenticated">
|
||||
Welcome, {{ username }}!
|
||||
<button @click="logout" class="logout-button">Logout</button>
|
||||
</span>
|
||||
<span v-else>
|
||||
<RouterLink to="/login">Login</RouterLink> |
|
||||
<RouterLink to="/register">Register</RouterLink>
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue