mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-15 05:56:36 +00:00
feat: add route pages
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { getTool, TOOLS } from '$lib/registry';
|
||||
import type { EntryGenerator, PageLoad } from './$types';
|
||||
|
||||
export const entries: EntryGenerator = () => TOOLS.map((tool) => ({ id: tool.id }));
|
||||
|
||||
export const load: PageLoad = ({ params }) => {
|
||||
const tool = getTool(params.id);
|
||||
if (!tool) {
|
||||
error(404, 'Инструмент не найден');
|
||||
}
|
||||
return { id: tool.id };
|
||||
};
|
||||
Reference in New Issue
Block a user