fix: 0 destinations redirect after creation
This commit is contained in:
parent
9c4e581d8b
commit
9121c6a078
@ -70,7 +70,11 @@
|
|||||||
{$t('application.configuration.no_configurable_destination')}
|
{$t('application.configuration.no_configurable_destination')}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<a href="/destinations/new" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
|
<a
|
||||||
|
href={`/destinations/new?from=/applications/${id}/configuration/destination`}
|
||||||
|
sveltekit:prefetch
|
||||||
|
class="add-icon bg-sky-600 hover:bg-sky-500"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
class="w-6"
|
class="w-6"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
export let payload: any;
|
export let payload: any;
|
||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
import { page } from '$app/stores';
|
||||||
import { post } from '$lib/api';
|
import { post } from '$lib/api';
|
||||||
import { errorNotification } from '$lib/common';
|
import { errorNotification } from '$lib/common';
|
||||||
import Setting from '$lib/components/Setting.svelte';
|
import Setting from '$lib/components/Setting.svelte';
|
||||||
import { appSession } from '$lib/store';
|
import { appSession } from '$lib/store';
|
||||||
import { t } from '$lib/translations';
|
import { t } from '$lib/translations';
|
||||||
|
|
||||||
|
const from = $page.url.searchParams.get('from');
|
||||||
let loading = false;
|
let loading = false;
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
@ -19,8 +20,7 @@
|
|||||||
const { id } = await post(`/destinations/new`, {
|
const { id } = await post(`/destinations/new`, {
|
||||||
...payload
|
...payload
|
||||||
});
|
});
|
||||||
await goto(`/destinations/${id}`);
|
return await goto(from || `/destinations/${id}`);
|
||||||
window.location.reload();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
@ -31,9 +31,15 @@
|
|||||||
|
|
||||||
<div class="flex justify-center px-6 pb-8">
|
<div class="flex justify-center px-6 pb-8">
|
||||||
<form on:submit|preventDefault={handleSubmit} class="grid grid-flow-row gap-2 py-4">
|
<form on:submit|preventDefault={handleSubmit} class="grid grid-flow-row gap-2 py-4">
|
||||||
<div class="flex items-start lg:items-center space-x-0 lg:space-x-4 pb-5 flex-col lg:flex-row space-y-4 lg:space-y-0">
|
<div
|
||||||
|
class="flex items-start lg:items-center space-x-0 lg:space-x-4 pb-5 flex-col lg:flex-row space-y-4 lg:space-y-0"
|
||||||
|
>
|
||||||
<div class="title font-bold">{$t('forms.configuration')}</div>
|
<div class="title font-bold">{$t('forms.configuration')}</div>
|
||||||
<button type="submit" class="btn btn-sm bg-destinations w-full lg:w-fit" class:loading disabled={loading}
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="btn btn-sm bg-destinations w-full lg:w-fit"
|
||||||
|
class:loading
|
||||||
|
disabled={loading}
|
||||||
>{loading
|
>{loading
|
||||||
? payload.isCoolifyProxyUsed
|
? payload.isCoolifyProxyUsed
|
||||||
? $t('destination.new.saving_and_configuring_proxy')
|
? $t('destination.new.saving_and_configuring_proxy')
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
export let payload: any;
|
export let payload: any;
|
||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
import { page } from '$app/stores';
|
||||||
import { post } from '$lib/api';
|
import { post } from '$lib/api';
|
||||||
import { errorNotification } from '$lib/common';
|
import { errorNotification } from '$lib/common';
|
||||||
import SimpleExplainer from '$lib/components/SimpleExplainer.svelte';
|
import SimpleExplainer from '$lib/components/SimpleExplainer.svelte';
|
||||||
import Setting from '$lib/components/Setting.svelte';
|
import Setting from '$lib/components/Setting.svelte';
|
||||||
import { t } from '$lib/translations';
|
import { t } from '$lib/translations';
|
||||||
|
|
||||||
|
const from = $page.url.searchParams.get('from');
|
||||||
let loading = false;
|
let loading = false;
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
@ -19,7 +20,7 @@
|
|||||||
const { id } = await post(`/destinations/new`, {
|
const { id } = await post(`/destinations/new`, {
|
||||||
...payload
|
...payload
|
||||||
});
|
});
|
||||||
return await goto(`/destinations/${id}`);
|
return await goto(from || `/destinations/${id}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user