a mini social media app for small communities
1module webapp
2
3import veb
4
5pub struct Context {
6 veb.Context
7pub mut:
8 title string
9}
10
11pub fn (ctx &Context) is_logged_in() bool {
12 return ctx.get_cookie('token') or { '' } != ''
13}
14
15pub fn (mut ctx Context) unauthorized(msg string) veb.Result {
16 ctx.res.set_status(.unauthorized)
17 return ctx.send_response_to_client('text/plain', msg)
18}