2022-03-21 20:20:41 -04:00
|
|
|
import type { PostVisibility } from "./types"
|
|
|
|
|
|
|
|
export default function getPostPath(visibility: PostVisibility, id: string) {
|
2022-03-23 18:42:22 -04:00
|
|
|
switch (visibility) {
|
|
|
|
case "private":
|
2022-04-12 19:48:12 -04:00
|
|
|
// return `/post/private/${id}`
|
2022-03-23 18:42:22 -04:00
|
|
|
case "protected":
|
2022-04-12 19:48:12 -04:00
|
|
|
// return `/post/protected/${id}`
|
2022-03-23 18:42:22 -04:00
|
|
|
case "unlisted":
|
|
|
|
case "public":
|
|
|
|
return `/post/${id}`
|
2022-03-30 23:01:24 -04:00
|
|
|
default:
|
|
|
|
console.error(`Unknown visibility: ${visibility}`)
|
|
|
|
return `/post/${id}`
|
2022-03-23 18:42:22 -04:00
|
|
|
}
|
2022-03-21 20:20:41 -04:00
|
|
|
}
|