OSDN Git Service

AppDelegateからウインドウに関する部分を分離した
[kcd/KCD.git] / KCD / AirCorpsChangeNameCommand.swift
1 //
2 //  AirCorpsChangeNameCommand.swift
3 //  KCD
4 //
5 //  Created by Hori,Masaki on 2017/01/08.
6 //  Copyright © 2017年 Hori,Masaki. All rights reserved.
7 //
8
9 import Cocoa
10
11 class AirCorpsChangeNameCommand: JSONCommand {
12     override class func canExecuteAPI(_ api: String) -> Bool {
13         if api == "/kcsapi/api_req_air_corps/change_name" { return true }
14         return false
15     }
16     
17     override func execute() {
18         guard let areaId = parameter["api_area_id"].int,
19             let rId = parameter["api_base_id"].int,
20             let name = parameter["api_name"].string
21             else { return }
22         let store = ServerDataStore.oneTimeEditor()
23         store.airBase(area: areaId, base: rId)?.name = name
24     }
25 }