-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
86 changed files
with
1,536 additions
and
4,544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { Admin } from '~~/server/db/schema'; | ||
|
||
declare module '#auth-utils' { | ||
interface User extends Admin {} | ||
} | ||
|
||
export {}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<script setup lang="ts"> | ||
import { registerSchema, loginSchema } from '~~/shared/schemas/authentication'; | ||
const props = defineProps<{ | ||
register: boolean; | ||
onboardingKey: string; | ||
}>(); | ||
const formSchema = toTypedSchema(props.register ? registerSchema : loginSchema); | ||
const { handleSubmit, errors, defineField } = useForm({ | ||
validationSchema: formSchema, | ||
}); | ||
const loginError = ref<string>(); | ||
// @ts-expect-error | ||
const [firstName] = defineField('firstName'); | ||
// @ts-expect-error | ||
const [lastName] = defineField('lastName'); | ||
const [email] = defineField('email'); | ||
const [password] = defineField('password'); | ||
const emits = defineEmits<{ | ||
done: []; | ||
}>(); | ||
const submit = handleSubmit(async (validatedData) => { | ||
try { | ||
await $fetch(`/api/${props.register ? 'register' : 'login'}`, { | ||
method: 'POST', | ||
body: validatedData, | ||
headers: { | ||
'x-onboarding-token': props.onboardingKey, | ||
}, | ||
}); | ||
emits('done'); | ||
} catch (e: any) { | ||
if (e.data.statusCode === 401) { | ||
loginError.value = e.data.message; | ||
} else { | ||
loginError.value = 'Something went wrong.'; | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col space-y-2"> | ||
<div class="flex flex-col justify-center"> | ||
<InputLabel class="text-center" label-class="text-xl" label="Personal Details" v-if="register" /> | ||
<InputLabel class="text-center" label-class="text-xl" label="Log back in" v-else /> | ||
<InputLabel | ||
class="text-center" | ||
label-class="!text-zinc-500" | ||
label="Registering as super admin for this instance." | ||
v-if="register" | ||
/> | ||
<InputLabel | ||
class="text-center" | ||
label-class="!text-zinc-500" | ||
label="Super admin already registered, log back in." | ||
v-else | ||
/> | ||
</div> | ||
<div class="flex space-x-2 w-full" v-if="register"> | ||
<!-- @vue-expect-error --> | ||
<InputText class="w-1/2" placeholder="First Name" v-model="firstName" :error="errors['firstName']" /> | ||
<!-- @vue-expect-error --> | ||
<InputText class="w-1/2" placeholder="Last Name" v-model="lastName" :error="errors['lastName']" /> | ||
</div> | ||
<InputText class="w-full" placeholder="Email" v-model="email" :error="errors['email']" /> | ||
|
||
<InputText | ||
class="w-full" | ||
placeholder="Password" | ||
type-override="password" | ||
v-model="password" | ||
:error="errors['password']" | ||
/> | ||
<InputButton @click="submit"> | ||
{{ register ? 'Save' : 'Continue' }} | ||
</InputButton> | ||
<InputLabel :error="loginError" v-if="loginError" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script setup lang="ts"> | ||
import { useVModel } from '@vueuse/core'; | ||
import type { SelectableOption } from '~~/shared/types/general'; | ||
const { data: reviewTags } = await useReviewTagsRepository(); | ||
const options: SelectableOption[] = reviewTagGroupVsIndex | ||
.flatMap((_, i) => reviewTags.value.filter((rt) => rt.parent === i)) | ||
.map((rt) => ({ | ||
id: rt.id, | ||
title: rt.title, | ||
logo: 'material-symbols:circle', | ||
logoClass: `text-${reviewTagColorVsIndex[rt.parent]}-200 rounded-full border border-${reviewTagColorVsIndex[rt.parent]}-600`, | ||
})); | ||
const props = defineProps<{ | ||
modelValue?: number; | ||
}>(); | ||
const selectedTag = useVModel(props, 'modelValue'); | ||
</script> | ||
|
||
<template> | ||
<AbstractDropdownSingleSelect :options title="Select Tag" v-model="selectedTag" /> | ||
</template> |
Oops, something went wrong.