Added basic login.

This commit is contained in:
2024-02-29 05:08:54 +01:00
parent 76a831eb50
commit 78b389e33a
21 changed files with 3553 additions and 189 deletions

View File

@@ -0,0 +1,43 @@
<template>
<div class="profile">
<div class="profile-header">
<img
v-if="profile.avatar"
:src="profile.avatar"
class="avatar"
>
<h2 class="username">{{ profile.username }}</h2>
</div>
</div>
</template>
<script setup>
import { inject } from 'vue';
const pageContext = inject('pageContext');
const profile = pageContext.pageProps.profile;
console.log('profile', profile);
</script>
<style scoped>
.profile-header {
display: flex;
align-items: center;
padding: .5rem 1rem;
color: var(--highlight-strong-30);
background: var(--grey-dark-40);
}
.username {
margin: 0;
}
.avatar {
width: 2rem;
height: 2rem;
border-radius: .25rem;
margin-right: 1rem;
}
</style>

View File

@@ -0,0 +1,14 @@
import { fetchUser } from '#/src/users.js';
export async function onBeforeRender(pageContext) {
const profile = await fetchUser(pageContext.routeParams.username);
return {
pageContext: {
title: profile.username,
pageProps: {
profile, // differentiate from authed 'user'
},
},
};
}

View File

@@ -0,0 +1 @@
export default '/user/@username';