package dev.inmo.postssystem.server

import dev.inmo.micro_utils.ktor.server.configurators.StatusPagesConfigurator
import io.ktor.application.call
import io.ktor.features.StatusPages
import io.ktor.http.HttpStatusCode
import io.ktor.response.respondRedirect

data class NotFoundStatusPageRedirectToIndex(
    val redirectTo: String
) : StatusPagesConfigurator.Element {
    override fun StatusPages.Configuration.invoke() {
        status(HttpStatusCode.NotFound) {
            call.respondRedirect(redirectTo)
        }
    }
}
