add bio in user page, there is a problem with matching on the SELECT btw, idk wtf is the type

This commit is contained in:
Swrup 2021-11-07 18:52:31 +01:00
parent c42c759d40
commit e502ec9584
4 changed files with 86 additions and 9 deletions

29
src/user_profile.eml.html Normal file
View file

@ -0,0 +1,29 @@
let f ?bio request =
% begin match Dream.session "nick" request with
% | None ->
not logged in
% | Some nick ->
%begin match bio with
% | None ->
% let bio = match User.get_bio nick with
% | Ok bio -> bio
% | Error e -> e
%in
<%s Format.sprintf "Hello %s !" nick %>
<%s! Dream.form_tag ~action:"/profile" request %>
<div class="mb-3">
<label for="bio" class="form-label">Bio</label>
<input name="bio" type="text" class="form-control" id="bio" aria-describedby="bioHelp" value="<%s bio %>" </input>
<div id="bioHelp" class="form-text">Who are you?</div>
</div>
<button type="submit" class="btn btn-primary">Save</button>
</form>
% | Some bio ->
% begin match User.update_bio bio nick with
% | Ok () ->
Bio updated !
% | Error e ->
<%s e %>
% end;
% end;
%end;