mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-14 03:59:15 +01:00
feat: ✨ Implement proper login and logout using UI
This commit is contained in:
parent
e0c41bb9b5
commit
3c8093a3d2
23 changed files with 273 additions and 193 deletions
|
|
@ -38,14 +38,13 @@ const route = useRoute();
|
|||
const client = useMegalodon(undefined, true);
|
||||
const username = (route.params.username as string).replace("@", "");
|
||||
|
||||
const account: Ref<Account | null> = ref(null);
|
||||
const accounts = useAccountSearch(client, username);
|
||||
const account = computed<Account | null>(
|
||||
() => accounts.value?.find((account) => account.acct === username) ?? null,
|
||||
);
|
||||
const accountId = computed(() => account.value?.id ?? null);
|
||||
|
||||
onMounted(async () => {
|
||||
const accounts = await useAccountSearch(client, username);
|
||||
account.value =
|
||||
(await accounts?.find((account) => account.acct === username)) ?? null;
|
||||
|
||||
useIntersectionObserver(skeleton, async (entries) => {
|
||||
if (
|
||||
entries[0].isIntersecting &&
|
||||
|
|
@ -70,7 +69,7 @@ const isLoadingTimeline = ref(true);
|
|||
const timelineParameters = ref({});
|
||||
const hasReachedEnd = ref(false);
|
||||
const { timeline, loadNext, loadPrev } = useAccountTimeline(
|
||||
client,
|
||||
client.value,
|
||||
accountId,
|
||||
timelineParameters,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const isLoading = ref(true);
|
|||
const timelineParameters = ref({});
|
||||
const hasReachedEnd = ref(false);
|
||||
const { timeline, loadNext, loadPrev } = useLocalTimeline(
|
||||
client,
|
||||
client.value,
|
||||
timelineParameters,
|
||||
);
|
||||
const skeleton = ref<HTMLSpanElement | null>(null);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
</VeeField>
|
||||
|
||||
<ButtonsPrimary type="submit" class="w-full" :disabled="isLoading">{{ isLoading ? "Registering..." :
|
||||
"Register" }}</ButtonsPrimary>
|
||||
"Register" }}</ButtonsPrimary>
|
||||
</VeeForm>
|
||||
</div>
|
||||
<div v-else>
|
||||
|
|
@ -133,14 +133,15 @@ const register = (result: {
|
|||
reason: string;
|
||||
}) => {
|
||||
isLoading.value = true;
|
||||
client?.registerAccount(
|
||||
result.username,
|
||||
result.email,
|
||||
result.password,
|
||||
true,
|
||||
"en",
|
||||
result.reason || "Empty reason",
|
||||
)
|
||||
ref(client)
|
||||
.value?.registerAccount(
|
||||
result.username,
|
||||
result.email,
|
||||
result.password,
|
||||
true,
|
||||
"en",
|
||||
result.reason || "Empty reason",
|
||||
)
|
||||
.then(async (res) => {
|
||||
navigateTo("/register/success");
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue