Merge branch 'main' of vulpine.solutions:sam/Foxnouns.NET
This commit is contained in:
		
						commit
						4a6b5f3b85
					
				
					 7 changed files with 29 additions and 12 deletions
				
			
		|  | @ -23,11 +23,6 @@ public class UsersController( | |||
|     public async Task<IActionResult> GetUserAsync(string userRef) | ||||
|     { | ||||
|         var user = await db.ResolveUserAsync(userRef, CurrentToken); | ||||
|         return await GetUserInnerAsync(user); | ||||
|     } | ||||
| 
 | ||||
|     private async Task<IActionResult> GetUserInnerAsync(User user) | ||||
|     { | ||||
|         return Ok(await userRendererService.RenderUserAsync( | ||||
|             user, | ||||
|             selfUser: CurrentUser, | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| <script> | ||||
| <script lang="ts"> | ||||
| 	import { page } from "$app/stores"; | ||||
| 	import neofox from "./neofox_confused_2048.png"; | ||||
| </script> | ||||
|  |  | |||
|  | @ -9,5 +9,5 @@ export async function load({ fetch, locals }) { | |||
| 		user = await request<User>(fetch, "GET", "/users/@me"); | ||||
| 	} catch {} | ||||
| 
 | ||||
| 	return { meta, user, token: locals.token }; | ||||
| 	return { meta, currentUser: user, token: locals.token }; | ||||
| } | ||||
|  |  | |||
|  | @ -6,5 +6,5 @@ | |||
| 	export let data: LayoutData; | ||||
| </script> | ||||
| 
 | ||||
| <Navbar user={data.user} /> | ||||
| <Navbar user={data.currentUser} /> | ||||
| <slot /> | ||||
|  |  | |||
|  | @ -11,10 +11,10 @@ | |||
| <p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p> | ||||
| 
 | ||||
| <p> | ||||
| 	are you logged in? {data.user !== undefined} | ||||
| 	{#if data.user} | ||||
| 		<br />hello, {data.user.username}! | ||||
| 		<br />your ID: {data.user.id} | ||||
| 	are you logged in? {data.currentUser !== undefined} | ||||
| 	{#if data.currentUser} | ||||
| 		<br />hello, {data.currentUser.username}! | ||||
| 		<br />your ID: {data.currentUser.id} | ||||
| 	{/if} | ||||
| </p> | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										12
									
								
								Foxnouns.Frontend/src/routes/@[username]/+page.server.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Foxnouns.Frontend/src/routes/@[username]/+page.server.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| import { error } from "@sveltejs/kit"; | ||||
| import type { User } from "$lib/api/user"; | ||||
| import request from "$lib/request"; | ||||
| 
 | ||||
| export const load = async ({ params, fetch }) => { | ||||
| 	try { | ||||
| 		const user = await request<User>(fetch, "GET", `/users/${params.username}`); | ||||
| 		return { user }; | ||||
| 	} catch { | ||||
| 		error(404, { message: "User not found" }); | ||||
| 	} | ||||
| }; | ||||
							
								
								
									
										10
									
								
								Foxnouns.Frontend/src/routes/@[username]/+page.svelte
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Foxnouns.Frontend/src/routes/@[username]/+page.svelte
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| <script lang="ts"> | ||||
| 	import type { PageData } from "./$types"; | ||||
| 	export let data: PageData; | ||||
| </script> | ||||
| 
 | ||||
| <svelte:head> | ||||
| 	<title>@{data.user.username} • pronouns.cc</title> | ||||
| </svelte:head> | ||||
| 
 | ||||
| <h1>this is the user page for @{data.user.username}</h1> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue