summaryrefslogtreecommitdiff
path: root/api/dns.go
blob: 3105f9106281b047ab3e213e651bf2a5215219e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package api

import (
	"log"
	"net/http"

	"git.hatecomputers.club/hatecomputers/hatecomputers.club/database"
)

func ListDNSRecordsContinuation(context *RequestContext, req *http.Request, resp http.ResponseWriter) ContinuationChain {
	return func(success Continuation, failure Continuation) ContinuationChain {
		dnsRecords, err := database.GetUserDNSRecords(context.DBConn, context.User.ID)
		if err != nil {
			log.Println(err)
			resp.WriteHeader(http.StatusInternalServerError)
			return failure(context, req, resp)
		}

		(*context.TemplateData)["DNSRecords"] = dnsRecords

		return success(context, req, resp)
	}
}