File size: 400 Bytes
fc69895
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { base } from "$app/paths";
import { redirect } from "@sveltejs/kit";

export async function load({ params, parent, fetch }) {
	const r = await fetch(`${base}/api/v2/models/${params.model}/subscribe`, {
		method: "POST",
	});

	if (!r.ok) {
		redirect(302, base + "/");
	}

	return {
		settings: await parent().then((data) => ({
			...data.settings,
			activeModel: params.model,
		})),
	};
}