Profile menu oluşturuldu. Bağlantı ve Page'ler eklendi.
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
<script>
|
||||
import { API, persistTokens, clearTokens } from "../utils/api.js";
|
||||
import { onMount } from "svelte";
|
||||
import { navigate } from "svelte-routing";
|
||||
import { API, persistTokens, clearTokens, getAccessToken } from "../utils/api.js";
|
||||
import logo from "../assets/image/logo.png";
|
||||
|
||||
let username = "";
|
||||
let password = "";
|
||||
let error = "";
|
||||
|
||||
onMount(() => {
|
||||
const token = getAccessToken();
|
||||
if (token) {
|
||||
navigate("/", { replace: true });
|
||||
}
|
||||
});
|
||||
|
||||
async function login() {
|
||||
const res = await fetch(`${API}/api/login`, {
|
||||
method: "POST",
|
||||
@@ -18,7 +27,8 @@
|
||||
persistTokens({ accessToken, refreshToken });
|
||||
if (accessToken) localStorage.setItem("token", accessToken); // Geçiş dönemi uyumluluğu
|
||||
if (user) localStorage.setItem("user", JSON.stringify(user));
|
||||
window.location.reload();
|
||||
// Router state beklemeden anında yönlendir
|
||||
navigate("/", { replace: true });
|
||||
} else {
|
||||
error = "Kullanıcı adı veya şifre hatalı.";
|
||||
clearTokens();
|
||||
|
||||
42
client/src/routes/Profile.svelte
Normal file
42
client/src/routes/Profile.svelte
Normal file
@@ -0,0 +1,42 @@
|
||||
<script>
|
||||
// Tasarım, diğer sayfalardaki yapıyı korur; şimdilik boş içerik.
|
||||
</script>
|
||||
|
||||
<section class="files">
|
||||
<div class="files-header">
|
||||
<div class="header-title">
|
||||
<h2>Profile</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="empty">
|
||||
Profil içeriği yakında.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.files {
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.files-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 24px;
|
||||
border: 1px dashed var(--border, #dcdcdc);
|
||||
border-radius: 10px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
40
client/src/routes/Settings.svelte
Normal file
40
client/src/routes/Settings.svelte
Normal file
@@ -0,0 +1,40 @@
|
||||
<script>
|
||||
// Tasarım diğer sayfalarla aynı iskelette; içerik placeholder.
|
||||
</script>
|
||||
|
||||
<section class="files">
|
||||
<div class="files-header">
|
||||
<div class="header-title">
|
||||
<h2>Settings</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="empty">Ayarlar içeriği yakında.</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.files {
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.files-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 24px;
|
||||
border: 1px dashed var(--border, #dcdcdc);
|
||||
border-radius: 10px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user