blob: aa760dcaedd992dde370d88f43ae83606433e7b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package shortcuts
import (
"lain/utils/urls"
"github.com/gofiber/fiber/v2"
)
func Redirect(ctx *fiber.Ctx, routeName string) error {
path, ok := urls.GetFullPath(routeName)
if !ok {
return fiber.ErrNotFound
}
return ctx.Redirect(path)
}
func RedirectWithStatus(ctx *fiber.Ctx, routeName string, statusCode int) error {
path, ok := urls.GetFullPath(routeName)
if !ok {
return fiber.ErrNotFound
}
return ctx.Redirect(path, statusCode)
}
|