bugfix
This commit is contained in:
@@ -4,7 +4,6 @@ import axios from "axios";
|
|||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
|
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const loggedIn = auth.loggedIn;
|
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
const content = ref("");
|
const content = ref("");
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ async function post() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="loggedIn">
|
<div v-if="auth.loggedIn">
|
||||||
<h1>Create Post</h1>
|
<h1>Create Post</h1>
|
||||||
<input type="text" v-model="title" placeholder="Title" />
|
<input type="text" v-model="title" placeholder="Title" />
|
||||||
<textarea v-model="content" placeholder="Content"></textarea>
|
<textarea v-model="content" placeholder="Content"></textarea>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { ref, onMounted, computed } from "vue";
|
|||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
|
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const loggedIn = auth.loggedIn;
|
|
||||||
const username = ref("");
|
const username = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ function handleLogin() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="loggedIn">
|
<div v-if="auth.loggedIn">
|
||||||
<h1>Logged in</h1>
|
<h1>Logged in</h1>
|
||||||
<p>{{ auth.user.ID }}</p>
|
<p>{{ auth.user.ID }}</p>
|
||||||
<p>{{ auth.user.username }}</p>
|
<p>{{ auth.user.username }}</p>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useAuthStore } from "@/stores/auth";
|
|||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const username = ref("");
|
const username = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
const loggedIn = auth.loggedIn;
|
|
||||||
|
|
||||||
function handleLogin() {
|
function handleLogin() {
|
||||||
auth.logIn(username.value, password.value);
|
auth.logIn(username.value, password.value);
|
||||||
@@ -17,7 +16,7 @@ function handleLogout() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="loggedIn">
|
<div v-if="auth.loggedIn">
|
||||||
<h1>Logged in</h1>
|
<h1>Logged in</h1>
|
||||||
<p>{{ auth.user.ID }}</p>
|
<p>{{ auth.user.ID }}</p>
|
||||||
<p>{{ auth.user.username }}</p>
|
<p>{{ auth.user.username }}</p>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const useAuthStore = defineStore("auth", () => {
|
|||||||
const user = ref({});
|
const user = ref({});
|
||||||
checkToken();
|
checkToken();
|
||||||
|
|
||||||
const loggedIn = computed(() => !!auth.user.username);
|
const loggedIn = computed(() => !!user.username);
|
||||||
|
|
||||||
async function logOut() {
|
async function logOut() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user