minor cleanup
This commit is contained in:
@@ -20,16 +20,14 @@
|
|||||||
<style></style>
|
<style></style>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref, defineEmits } from 'vue'
|
|
||||||
import { Form } from '@primevue/forms'
|
import { Form } from '@primevue/forms'
|
||||||
import InputText from 'primevue/inputtext'
|
import InputText from 'primevue/inputtext'
|
||||||
import Button from 'primevue/button'
|
import Button from 'primevue/button'
|
||||||
import Password from 'primevue/password'
|
import Password from 'primevue/password'
|
||||||
import axios from 'axios'
|
|
||||||
import { useUserData, login, logout, resetPassword } from './user'
|
import { useUserData, login, logout, resetPassword } from './user'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'onAction')
|
(e: 'onAction'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const userData = useUserData()
|
const userData = useUserData()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
|
import type { Ref } from 'vue'
|
||||||
|
|
||||||
export interface User {
|
export interface User {
|
||||||
username: string
|
username: string
|
||||||
@@ -7,7 +8,7 @@ export interface User {
|
|||||||
authenticated: boolean
|
authenticated: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const $current_user = ref({ username: 'username', is_admin: false, authenticated: false })
|
const $current_user = ref({ id: 0, username: 'username', is_admin: false, authenticated: false })
|
||||||
export const current_user = computed((): User => {
|
export const current_user = computed((): User => {
|
||||||
return $current_user.value
|
return $current_user.value
|
||||||
})
|
})
|
||||||
@@ -18,7 +19,7 @@ function loadCurrentUser(): void {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useUserData(): void {
|
export function useUserData(): Ref<User> {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadCurrentUser()
|
loadCurrentUser()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user