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