Skip to content

Commit acfa65c

Browse files
Use rawValue instead of stringValue
1 parent b73cdc2 commit acfa65c

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

FrontEnd/scripts/controllers/use_this_package_panel_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class UseThisPackagePanelController extends Controller {
2626
const optionElement = selectElement.options[selectElement.selectedIndex]
2727
const packageName = optionElement.dataset.package
2828
const productName = optionElement.dataset.product
29+
const type = optionElement.dataset.type
2930
const prefix = type == "plugin" ? ".plugin" : ".product"
3031
this.snippetTarget.value = `${prefix}(name: "${productName}", package: "${packageName}")`
3132
}

Sources/App/Controllers/API/API+PackageController+GetRoute+Model.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,11 @@ extension API.PackageController.GetRoute.Model {
230230
self.type = type
231231
}
232232

233-
enum ProductType: Codable, Equatable {
233+
enum ProductType: String, Codable, Equatable {
234234
case library
235235
case executable
236236
case plugin
237237

238-
var stringValue: String {
239-
switch self {
240-
case .library:
241-
return "library"
242-
case .executable:
243-
return "executable"
244-
case .plugin:
245-
return "plugin"
246-
}
247-
}
248-
249238
init?(_ productType: App.ProductType) {
250239
switch productType {
251240
case .executable:

Sources/App/Views/PackageController/GetRoute.Model+ext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ extension API.PackageController.GetRoute.Model {
420420
.option(
421421
.data(named: "package", value: package),
422422
.data(named: "product", value: product.name),
423-
.data(named: "type", value: product.type.stringValue),
423+
.data(named: "type", value: product.type.rawValue),
424424
.value(product.name),
425425
.label(product.name)
426426
)

0 commit comments

Comments
 (0)