@@ -16,8 +16,6 @@ import (
16
16
"github.com/gorilla/sessions"
17
17
)
18
18
19
- const paramID = "{id}"
20
-
21
19
func NewRouter (ct pages.Controller , app core.App , fileFS fs.FS , csrfSecret []byte , ss sessions.Store ) * chi.Mux {
22
20
r := chi .NewRouter ()
23
21
@@ -62,74 +60,74 @@ func NewRouter(ct pages.Controller, app core.App, fileFS fs.FS, csrfSecret []byt
62
60
pages .EnvelopeCreateView (ct , app ))
63
61
r .Post (routes .EnvelopeCreate ().String (),
64
62
pages .EnvelopeCreate (ct , app ))
65
- r .Get (routes .Envelope (paramID ).String (),
63
+ r .Get (routes .Envelope (pages . ParamID ).String (),
66
64
pages .EnvelopeView (ct , app ))
67
- r .Delete (routes .Envelope (paramID ).String (),
65
+ r .Delete (routes .Envelope (pages . ParamID ).String (),
68
66
pages .EnvelopeDelete (ct , app ))
69
- r .Get (routes .EnvelopeHTML (paramID ).String (),
67
+ r .Get (routes .EnvelopeHTML (pages . ParamID ).String (),
70
68
pages .EnvelopeHTMLView (ct , app ))
71
- r .Post (routes .EnvelopeEndpointSend (paramID ).String (),
69
+ r .Post (routes .EnvelopeEndpointSend (pages . ParamID ).String (),
72
70
pages .EnvelopeEndpointSend (ct , app ))
73
71
{
74
- envelopeListView := pages .EnvelopeListView (ct , app )
72
+ view := pages .EnvelopeListView (ct , app )
75
73
r .Get (routes .EnvelopeList ().String (),
76
- envelopeListView )
74
+ view )
77
75
r .Delete (routes .EnvelopeList ().String (),
78
- pages .EnvelopeListDrop (ct , app , envelopeListView ))
76
+ pages .EnvelopeListDrop (ct , app , view ))
79
77
}
80
78
81
79
// Attachment
82
80
r .Get (routes .AttachmentFile ("*" ).String (),
83
81
pages .Files (ct , app , fileFS ))
84
82
{
85
- attachmentListView := pages .AttachmentListView (ct , app )
83
+ view := pages .AttachmentListView (ct , app )
86
84
r .Get (routes .AttachmentList ().String (),
87
- attachmentListView )
85
+ view )
88
86
r .Post (routes .AttachmentTrim ().String (),
89
- pages .AttachmentTrim (ct , app , attachmentListView ))
87
+ pages .AttachmentTrim (ct , app , view ))
90
88
}
91
89
92
90
// Endpoint
93
- r .Get (routes .Endpoint (paramID ).String (),
91
+ r .Get (routes .Endpoint (pages . ParamID ).String (),
94
92
pages .EndpointView (ct , app ))
95
- r .Post (routes .Endpoint (paramID ).String (),
93
+ r .Post (routes .Endpoint (pages . ParamID ).String (),
96
94
pages .EndpointUpdate (ct , app ))
97
95
r .Get (routes .EndpointList ().String (),
98
96
pages .EndpointListView (ct , app ))
99
- r .Post (routes .EndpointTest (paramID ).String (),
97
+ r .Post (routes .EndpointTest (pages . ParamID ).String (),
100
98
pages .EndpointTest (ct , app ))
101
99
r .Get (routes .EndpointCreate ().String (),
102
100
pages .EndpointCreateView (ct , app ))
103
101
r .Post (routes .EndpointCreate ().String (),
104
102
pages .EndpointCreate (ct , app ))
105
- r .Delete (routes .Endpoint (paramID ).String (),
103
+ r .Delete (routes .Endpoint (pages . ParamID ).String (),
106
104
pages .EndpointDelete (ct , app ))
107
105
108
106
// Traces
109
107
{
110
- traceListView := pages .TraceListView (ct , app )
108
+ view := pages .TraceListView (ct , app )
111
109
r .Get (routes .TraceList ().String (),
112
- traceListView )
110
+ view )
113
111
r .Delete (routes .TraceList ().String (),
114
- pages .TraceListDrop (ct , app , traceListView ))
112
+ pages .TraceListDrop (ct , app , view ))
115
113
}
116
114
117
115
// Rules
118
116
r .Get (routes .RuleList ().String (),
119
117
pages .RuleListView (ct , app ))
120
- r .Get (routes .Rule (paramID ).String (),
118
+ r .Get (routes .Rule (pages . ParamID ).String (),
121
119
pages .RuleView (ct , app ))
122
- r .Delete (routes .Rule (paramID ).String (),
120
+ r .Delete (routes .Rule (pages . ParamID ).String (),
123
121
pages .RuleDelete (ct , app ))
124
- r .Post (routes .Rule (paramID ).String (),
122
+ r .Post (routes .Rule (pages . ParamID ).String (),
125
123
pages .RuleUpdate (ct , app ))
126
124
r .Post (routes .RuleExpressionCheck ().String (),
127
125
pages .RuleExpressionCheck (ct , app ))
128
126
r .Get (routes .RuleCreate ().String (),
129
127
pages .RuleCreateView (ct , app ))
130
128
r .Post (routes .RuleCreate ().String (),
131
129
pages .RuleCreate (ct , app ))
132
- r .Post (routes .RuleToggle (paramID ).String (),
130
+ r .Post (routes .RuleToggle (pages . ParamID ).String (),
133
131
pages .RuleToggle (ct , app ))
134
132
135
133
// Retention Policy
@@ -141,11 +139,11 @@ func NewRouter(ct pages.Controller, app core.App, fileFS fs.FS, csrfSecret []byt
141
139
pages .EndpointFormConfigComponent (ct , app ))
142
140
r .Get (routes .StorageStatsComponent ().String (),
143
141
pages .StorageStatsComponent (ct , app ))
144
- r .Get (routes .EnvelopeTabComponent (paramID , routes .EnvelopeTabText ).String (),
142
+ r .Get (routes .EnvelopeTabComponent (pages . ParamID , routes .EnvelopeTabText ).String (),
145
143
pages .EnvelopeTabComponent (ct , app , routes .EnvelopeTabText ))
146
- r .Get (routes .EnvelopeTabComponent (paramID , routes .EnvelopeTabHTML ).String (),
144
+ r .Get (routes .EnvelopeTabComponent (pages . ParamID , routes .EnvelopeTabHTML ).String (),
147
145
pages .EnvelopeTabComponent (ct , app , routes .EnvelopeTabHTML ))
148
- r .Get (routes .EnvelopeTabComponent (paramID , routes .EnvelopeTabAttachments ).String (),
146
+ r .Get (routes .EnvelopeTabComponent (pages . ParamID , routes .EnvelopeTabAttachments ).String (),
149
147
pages .EnvelopeTabComponent (ct , app , routes .EnvelopeTabAttachments ))
150
148
r .Get (routes .RecentEnvelopeListComponent ().String (),
151
149
pages .RecentEnvelopeListComponent (ct , app ))
0 commit comments