rename signin / signup to login / register
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import 'vue-sonner/style.css';
|
||||
|
||||
import { getWarrens } from './lib/api/warrens';
|
||||
|
||||
const store = useWarrenStore();
|
||||
|
||||
store.warrens = await getWarrens();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -101,7 +101,7 @@ const AVATAR =
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem @click="logout">
|
||||
<Icon name="lucide:door-open" />
|
||||
Sign out
|
||||
Log out
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbList,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from '@/components/ui/breadcrumb';
|
||||
import CreateDirectoryDialog from '~/components/actions/CreateDirectoryDialog.vue';
|
||||
import UploadDialog from '~/components/actions/UploadDialog.vue';
|
||||
import { getWarrens } from '~/lib/api/warrens';
|
||||
const uploadStore = useUploadStore();
|
||||
|
||||
const route = useRoute();
|
||||
const store = useWarrenStore();
|
||||
|
||||
store.warrens = await getWarrens();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -6,7 +6,6 @@ export async function loginUser(
|
||||
email: string,
|
||||
password: string
|
||||
): Promise<{ success: boolean }> {
|
||||
console.log('logging in...', email, password);
|
||||
const { data, error } = await useFetch<ApiResponse<{ token: string }>>(
|
||||
getApiUrl('auth/login'),
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export async function logout() {
|
||||
useAuthSession().value = null;
|
||||
await navigateTo({
|
||||
path: '/signin',
|
||||
path: '/login',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
export default defineNuxtRouteMiddleware((to, _from) => {
|
||||
if (
|
||||
useAuthSession().value != null ||
|
||||
to.name === 'signin' ||
|
||||
to.name === 'signup'
|
||||
to.name === 'login' ||
|
||||
to.name === 'register'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
return navigateTo({
|
||||
path: '/signin',
|
||||
path: 'login',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,6 +13,9 @@ definePageMeta({
|
||||
layout: 'auth',
|
||||
middleware: ['not-authenticated'],
|
||||
});
|
||||
useHead({
|
||||
title: 'Login - Warren',
|
||||
});
|
||||
|
||||
// TODO: Get this from the backend
|
||||
const OPEN_ID = false;
|
||||
@@ -50,9 +53,9 @@ function onKeyDown(e: KeyboardEvent) {
|
||||
<template>
|
||||
<Card class="w-full max-w-sm">
|
||||
<CardHeader>
|
||||
<CardTitle class="text-2xl">Sign in</CardTitle>
|
||||
<CardTitle class="text-2xl">Login</CardTitle>
|
||||
<CardDescription>
|
||||
Enter your email and password to sign in to your account.
|
||||
Enter your email and password to log in to your account.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="grid gap-4">
|
||||
@@ -82,13 +85,13 @@ function onKeyDown(e: KeyboardEvent) {
|
||||
</CardContent>
|
||||
<CardFooter class="flex-col gap-2">
|
||||
<Button class="w-full" :disabled="!inputValid" @click="submit"
|
||||
>Sign in</Button
|
||||
>Log in</Button
|
||||
>
|
||||
<Button class="w-full" variant="outline" :disabled="!OPEN_ID"
|
||||
>OpenID Connect</Button
|
||||
>
|
||||
<NuxtLink to="/signup" class="w-full">
|
||||
<Button class="w-full" variant="ghost">Sign up instead</Button>
|
||||
<NuxtLink to="/register" class="w-full">
|
||||
<Button class="w-full" variant="ghost">Register instead</Button>
|
||||
</NuxtLink>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
@@ -13,6 +13,9 @@ definePageMeta({
|
||||
layout: 'auth',
|
||||
middleware: ['not-authenticated'],
|
||||
});
|
||||
useHead({
|
||||
title: 'Register - Warren',
|
||||
});
|
||||
|
||||
const registering = ref(false);
|
||||
const username = ref('');
|
||||
@@ -36,7 +39,7 @@ async function submit() {
|
||||
);
|
||||
|
||||
if (success) {
|
||||
await navigateTo({ path: '/signin' });
|
||||
await navigateTo({ path: '/login' });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,7 +50,7 @@ async function submit() {
|
||||
<template>
|
||||
<Card class="w-full max-w-sm">
|
||||
<CardHeader>
|
||||
<CardTitle class="text-2xl">Sign up</CardTitle>
|
||||
<CardTitle class="text-2xl">Register</CardTitle>
|
||||
<CardDescription>Create a new user account</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="grid gap-4">
|
||||
@@ -89,10 +92,10 @@ async function submit() {
|
||||
class="w-full"
|
||||
:disabled="!allFieldsValid || registering"
|
||||
@click="submit"
|
||||
>Sign up</Button
|
||||
>Register</Button
|
||||
>
|
||||
<NuxtLink to="/signin" class="w-full">
|
||||
<Button class="w-full" variant="ghost">Sign in instead</Button>
|
||||
<NuxtLink to="/login" class="w-full">
|
||||
<Button class="w-full" variant="ghost">Log in instead</Button>
|
||||
</NuxtLink>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
Reference in New Issue
Block a user