fixed routes

This commit is contained in:
Omer Sabic 2024-05-29 21:20:46 +02:00
parent ddc35304da
commit 1f38ef05b9
6 changed files with 12 additions and 12 deletions

View File

@ -4,7 +4,7 @@ import { redirect } from "@sveltejs/kit";
/** @type {import("./$types").LayoutServerLoad} */ /** @type {import("./$types").LayoutServerLoad} */
export const load = async ({fetch, cookies}) => { export const load = async ({fetch, cookies}) => {
if(!cookies.get("token")) { if(!cookies.get("token")) {
return redirect(302, "/app/auth"); return redirect(302, "/auth");
} }
const res = await fetch(config.api_url+"/me"); const res = await fetch(config.api_url+"/me");
if(res.status > 399 && res.status < 499) { if(res.status > 399 && res.status < 499) {
@ -12,7 +12,7 @@ export const load = async ({fetch, cookies}) => {
path: "/" path: "/"
}); });
redirect(302, "/app/auth"); redirect(302, "/auth");
} }
const data = await res.json(); const data = await res.json();

View File

@ -21,15 +21,15 @@
export let data; export let data;
const navs = [ const navs = [
{ name: 'Dashboard', redirect: '/app' }, { name: 'Dashboard', redirect: '/' },
{ name: 'Articles', redirect: '/app/articles' }, { name: 'Articles', redirect: '/articles' },
{ name: 'Emails', redirect: '/app/emails' }, { name: 'Emails', redirect: '/emails' },
{ name: 'Website', redirect: '/app/website' }, { name: 'Website', redirect: '/website' },
// { name: 'Analytics', redirect: '##' }, // { name: 'Analytics', redirect: '##' },
]; ];
async function logout() { async function logout() {
fetch("/app/auth/logout"); fetch("/auth/logout");
window.location.href = "/" window.location.href = "/"
} }
</script> </script>

View File

@ -9,7 +9,7 @@ export const load = async ({fetch, cookies}) => {
// path: "/" // path: "/"
// }); // });
redirect(302, "/app/auth"); redirect(302, "/auth");
} }
const data = await res.json(); const data = await res.json();

View File

@ -64,7 +64,7 @@
<Card.Title>Articles</Card.Title> <Card.Title>Articles</Card.Title>
<Card.Description>Recent articles written from your youtube videos.</Card.Description> <Card.Description>Recent articles written from your youtube videos.</Card.Description>
</div> </div>
<Button href="/app/articles" size="sm" class="ml-auto gap-1"> <Button href="/articles" size="sm" class="ml-auto gap-1">
View All View All
<ArrowUpRight class="h-4 w-4" /> <ArrowUpRight class="h-4 w-4" />
</Button> </Button>
@ -101,7 +101,7 @@
<Card.Title>Recent Signups</Card.Title> <Card.Title>Recent Signups</Card.Title>
<!-- <Card.Description>Recent articles written from your youtube videos.</Card.Description> --> <!-- <Card.Description>Recent articles written from your youtube videos.</Card.Description> -->
</div> </div>
<Button href="/app/emails" size="sm" class="ml-auto gap-1"> <Button href="/emails" size="sm" class="ml-auto gap-1">
View All View All
<ArrowUpRight class="h-4 w-4" /> <ArrowUpRight class="h-4 w-4" />
</Button> </Button>

View File

@ -21,7 +21,7 @@
* @param {string} id * @param {string} id
*/ */
function editArticle(id) { function editArticle(id) {
fetch('/app/articles/getArticleBody?id=' + id) fetch('/articles/getArticleBody?id=' + id)
.then((x) => x.json()) .then((x) => x.json())
.then((data) => { .then((data) => {
editingContent = data.article; editingContent = data.article;

View File

@ -9,7 +9,7 @@
export let data; export let data;
async function exportAsCsv() { async function exportAsCsv() {
const response = await fetch('/app/emails/export'); const response = await fetch('/emails/export');
const csvData = await response.text(); const csvData = await response.text();
// Create a blob from the CSV data // Create a blob from the CSV data