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

@@ -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}`);
}
};