CoastalCommitsPastes/client/lib/get-post-path.ts

17 lines
406 B
TypeScript
Raw Normal View History

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":
return `/post/private/${id}`
case "protected":
return `/post/protected/${id}`
case "unlisted":
case "public":
return `/post/${id}`
default:
console.error(`Unknown visibility: ${visibility}`)
return `/post/${id}`
2022-03-23 18:42:22 -04:00
}
}