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} */
export const load = async ({fetch, cookies}) => {
if(!cookies.get("token")) {
return redirect(302, "/app/auth");
return redirect(302, "/auth");
}
const res = await fetch(config.api_url+"/me");
if(res.status > 399 && res.status < 499) {
@ -12,7 +12,7 @@ export const load = async ({fetch, cookies}) => {
path: "/"
});
redirect(302, "/app/auth");
redirect(302, "/auth");
}
const data = await res.json();

View File

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

View File

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

View File

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

View File

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

View File

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