changed dev and production base url

This commit is contained in:
Alex
2025-03-01 12:12:40 +01:00
parent 7216a48f4e
commit 1d57b8e8e8
14 changed files with 55 additions and 48 deletions

View File

@@ -1,24 +1,22 @@
<script>
// import Developer from "$lib/img/hero-image.png";
// import Developer from "$lib/img/hero-image.png";
const year = new Date().getFullYear();
const year = new Date().getFullYear();
</script>
<footer class="footer-container">
<div class="footer-branding-container">
<div class="footer-branding">
<a class="footer-crafted-by-container" href="https://github.com/Sirneij">
<span>Developed by</span>
<!-- <img
<div class="footer-branding-container">
<div class="footer-branding">
<a class="footer-crafted-by-container" href="https://github.com/17Halbe">
<span>Developed by</span>
<!-- <img
class="footer-branded-crafted-img"
src={Developer}
alt="Alexander Stölting"
/> -->
</a>
</a>
<span class="footer-copyright"
>&copy; {year} Alexander Stölting. All Rights Reserved.</span
>
</div>
</div>
<span class="footer-copyright">&copy; {year} Alexander Stölting. All Rights Reserved.</span>
</div>
</div>
</footer>

View File

@@ -1,6 +1,7 @@
<script>
import { onMount, onDestroy } from 'svelte';
import { applyAction, enhance } from '$app/forms';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { t } from 'svelte-i18n';
import { writable } from 'svelte/store';
@@ -80,11 +81,11 @@
</div>
<div class="header-right" class:mobile-menu-open={isMobileMenuOpen}>
<div class="header-nav-item" class:active={$page.url.pathname === '/'}>
<a href="/">home</a>
<a href={`${base}/`}>home</a>
</div>
{#if !$page.data.user}
<div class="header-nav-item" class:active={$page.url.pathname === '/auth/login'}>
<a href="/auth/login">login</a>
<div class="header-nav-item" class:active={$page.url.pathname === `${base}/auth/login`}>
<a href={`${base}/auth/login`}>login</a>
</div>
<!-- <div
class="header-nav-item"
@@ -94,7 +95,7 @@
</div> -->
{:else}
<div class="header-nav-item">
<a href="/auth/about/{$page.data.user.id}">
<a href={`${base}/auth/about/${$page.data.user.id}`}>
<!-- <img
src={$page.data.user.profile_picture ? $page.data.user.profile_picture : Avatar}
alt={`${$page.data.user.first_name} ${$page.data.user.last_name}`}
@@ -106,9 +107,9 @@
{#if $page.data.user.role_id > 0}
<div
class="header-nav-item"
class:active={$page.url.pathname.startsWith('/auth/admin/users')}
class:active={$page.url.pathname.startsWith(`${base}/auth/admin/users`)}
>
<a href="/auth/admin/users">{$t('user.management')}</a>
<a href={`${base}/auth/admin/users`}>{$t('user.management')}</a>
</div>
{/if}
<!-- {#if $page.data.user.is_superuser}
@@ -121,7 +122,7 @@
{/if} -->
<form
class="header-nav-item"
action="/auth/logout"
action={`${base}/auth/logout`}
method="POST"
use:enhance={async () => {
return async ({ result }) => {

View File

@@ -3,11 +3,11 @@
</script> -->
<div class="hero-container">
<!-- <div class="hero-logo"><img src={Developer} alt="Alexander Stölting" /></div> -->
<h3 class="hero-subtitle subtitle">Backend vom Carsharing Zeug</h3>
<div class="hero-buttons-container">
<a class="button-dark" href="https://tiny-bits.net/" data-learn-more
>Auf zu Tiny Bits</a
>
</div>
<!-- <div class="hero-logo"><img src={Developer} alt="Alexander Stölting" /></div> -->
<h3 class="hero-subtitle subtitle">Backend vom Carsharing Zeug</h3>
<div class="hero-buttons-container">
<a class="button-dark" href="https://carsharing-hasloh.de/" data-learn-more
>Auf zur Carsharing Webseite</a
>
</div>
</div>

View File

@@ -2,6 +2,7 @@ import { BASE_API_URI } from '$lib/utils/constants';
import { formatError, userDatesFromRFC3339 } from '$lib/utils/helpers';
import { fail, redirect } from '@sveltejs/kit';
import { formDataToObject, processUserFormData } from '$lib/utils/processing';
import { base } from '$app/paths';
/**
* @typedef {Object} UpdateData
@@ -12,7 +13,7 @@ import { formDataToObject, processUserFormData } from '$lib/utils/processing';
export async function load({ locals, params }) {
// redirect user if not logged in
if (!locals.user) {
throw redirect(302, `/auth/login?next=/auth/about/${params.id}`);
throw redirect(302, `${base}/auth/login?next=${base}/auth/about/${params.id}`);
}
}
@@ -57,7 +58,7 @@ export const actions = {
const response = await res.json();
locals.user = response;
userDatesFromRFC3339(locals.user);
throw redirect(303, `/auth/about/${response.id}`);
throw redirect(303, `${base}/auth/about/${response.id}`);
},
/**

View File

@@ -1,6 +1,7 @@
import { BASE_API_URI } from '$lib/utils/constants';
import { redirect } from '@sveltejs/kit';
import { userDatesFromRFC3339, refreshCookie } from '$lib/utils/helpers';
import { base } from '$app/paths';
/** @type {import('./$types').LayoutServerLoad} */
export async function load({ cookies, fetch, locals }) {
@@ -15,7 +16,7 @@ export async function load({ cookies, fetch, locals }) {
if (!response.ok) {
// Clear the invalid JWT cookie
cookies.delete('jwt', { path: '/' });
throw redirect(302, '/auth/login?next=admin/users/');
throw redirect(302, `${base}/auth/login?next=${base}admin/users/`);
}
const data = await response.json();
@@ -42,6 +43,6 @@ export async function load({ cookies, fetch, locals }) {
// In case of any error, clear the JWT cookie
cookies.delete('jwt', { path: '/' });
throw redirect(302, '/auth/login?next=admin/users/');
throw redirect(302, `${base}/auth/login?next=${base}/admin/users/`);
}
}

View File

@@ -10,15 +10,16 @@ import {
processSubscriptionFormData,
processUserFormData
} from '$lib/utils/processing';
import { base } from '$app/paths';
/** @type {import('./$types').PageServerLoad} */
export async function load({ locals }) {
// redirect user if not logged in
if (!locals.user) {
throw redirect(302, `/auth/login?next=/auth/admin/users`);
throw redirect(302, `${base}/auth/login?next=${base}/auth/admin/users`);
}
if (locals.user.role_id === 0) {
throw redirect(302, `/auth/about/${locals.user.id}`);
throw redirect(302, `${base}/auth/about/${locals.user.id}`);
}
}
@@ -66,7 +67,7 @@ export const actions = {
console.log('Server success response:', response);
locals.user = response;
userDatesFromRFC3339(locals.user);
throw redirect(303, `/auth/admin/users`);
throw redirect(303, `${base}/auth/admin/users`);
},
/**
@@ -108,7 +109,7 @@ export const actions = {
const response = await res.json();
console.log('Server success response:', response);
throw redirect(303, `/auth/admin/users`);
throw redirect(303, `${base}/auth/admin/users`);
},
/**
@@ -148,7 +149,7 @@ export const actions = {
const response = await res.json();
console.log('Server success response:', response);
throw redirect(303, `/auth/admin/users`);
throw redirect(303, `${base}/auth/admin/users`);
},
/**
@@ -188,6 +189,6 @@ export const actions = {
const response = await res.json();
console.log('Server success response:', response);
throw redirect(303, `/auth/admin/users`);
throw redirect(303, `${base}/auth/admin/users`);
}
};

View File

@@ -1,5 +1,6 @@
<script>
import { applyAction, enhance } from '$app/forms';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { receive, send } from '$lib/utils/helpers';
import { t } from 'svelte-i18n';
@@ -53,7 +54,8 @@
name="password"
placeholder={$t('placeholder.password')}
/>
<a href="/auth/password/change" class="forgot-password">{$t('forgot_password')}?</a>
<a href={`${base}/auth/password/change`} class="forgot-password">{$t('forgot_password')}?</a
>
</div>
</div>
<div class="btn-container">

View File

@@ -1,3 +1,4 @@
import { base } from '$app/paths';
import { BASE_API_URI } from '$lib/utils/constants';
import { fail, redirect } from '@sveltejs/kit';
@@ -5,7 +6,7 @@ import { fail, redirect } from '@sveltejs/kit';
export async function load({ locals }) {
// redirect user if not logged in
if (!locals.user) {
throw redirect(302, `/auth/login?next=/`);
throw redirect(302, `${base}/auth/login?next=/`);
}
}
@@ -49,6 +50,6 @@ export const actions = {
});
}
// redirect the user
throw redirect(302, '/auth/login');
throw redirect(302, `${base}/auth/login`);
}
};

View File

@@ -1,3 +1,4 @@
import { base } from '$app/paths';
import { BASE_API_URI } from '$lib/utils/constants';
import { formatError } from '$lib/utils/helpers';
import { fail, redirect } from '@sveltejs/kit';
@@ -28,6 +29,6 @@ export const actions = {
const response = await res.json();
// redirect the user
throw redirect(302, `/auth/confirming?message=${response.message}`);
throw redirect(302, `${base}/auth/confirming?message=${response.message}`);
}
};

View File

@@ -1,3 +1,4 @@
import { base } from '$app/paths';
import { BASE_API_URI } from '$lib/utils/constants';
import { formatError } from '$lib/utils/helpers';
import { fail, redirect } from '@sveltejs/kit';
@@ -44,6 +45,6 @@ export const actions = {
const response = await res.json();
// redirect the user
throw redirect(302, `/auth/login?message=${response.message}`);
throw redirect(302, `${base}/auth/login?message=${response.message}`);
}
};