feat: add username availability check API endpoint
feat: create user image retrieval API endpoint feat: enhance coin page with dynamic data fetching and improved UI feat: implement coin creation form with validation and submission logic feat: add user settings page with profile update functionality
This commit is contained in:
parent
9aa4ba157b
commit
16ad425bb5
48 changed files with 3030 additions and 326 deletions
30
website/src/lib/stores/portfolio-data.ts
Normal file
30
website/src/lib/stores/portfolio-data.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { writable } from 'svelte/store';
|
||||
|
||||
export interface PortfolioData {
|
||||
baseCurrencyBalance: number;
|
||||
totalCoinValue: number;
|
||||
totalValue: number;
|
||||
coinHoldings: Array<{
|
||||
symbol: string;
|
||||
quantity: number;
|
||||
currentPrice: number;
|
||||
value: number;
|
||||
}>;
|
||||
currency: string;
|
||||
}
|
||||
|
||||
export const PORTFOLIO_DATA = writable<PortfolioData | null>(null);
|
||||
|
||||
export async function fetchPortfolioData() {
|
||||
try {
|
||||
const response = await fetch('/api/portfolio/total');
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
PORTFOLIO_DATA.set(data);
|
||||
return data;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch portfolio data:', error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -3,11 +3,14 @@ import { writable } from 'svelte/store';
|
|||
export type User = {
|
||||
id: string;
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
isAdmin: boolean;
|
||||
image: string;
|
||||
isBanned: boolean;
|
||||
banReason: string | null;
|
||||
avatarUrl: string | null;
|
||||
bio: string;
|
||||
} | null;
|
||||
|
||||
export const USER_DATA = writable<User>(undefined);
|
||||
Reference in a new issue