Mercurial Hosting > linkmystyle
view src/delete_link.js.luan @ 1:2776f06236b4
add source.html
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 11 Jul 2025 21:17:19 -0600 |
parents | 8f4df159f06b |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Link = require "site:/lib/Link.luan" local User = require "site:/lib/User.luan" return function() local user = User.current() or error() local link_id = Http.request.parameters.link or error() local link = Link.get_by_id(link_id) if link ~= nil then link.user_id == user.id or error() link.delete() end Io.stdout = Http.response.text_writer() %> let div = document.querySelector('div[link="<%=link_id%>"]'); if(div) div.outerHTML = ''; <% end