Initial commit from Create Next App

This commit is contained in:
Kaur Laanemäe
2025-04-30 13:29:42 +03:00
commit 60d6adcd94
53 changed files with 5495 additions and 0 deletions

16
utils/utils.ts Normal file
View File

@@ -0,0 +1,16 @@
import { redirect } from "next/navigation";
/**
* Redirects to a specified path with an encoded message as a query parameter.
* @param {('error' | 'success')} type - The type of message, either 'error' or 'success'.
* @param {string} path - The path to redirect to.
* @param {string} message - The message to be encoded and added as a query parameter.
* @returns {never} This function doesn't return as it triggers a redirect.
*/
export function encodedRedirect(
type: "error" | "success",
path: string,
message: string,
) {
return redirect(`${path}?${type}=${encodeURIComponent(message)}`);
}