mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
agent, ui: move to post body to avoid encodeURI complications
This commit is contained in:
committed by
Aiden McClelland
parent
234fc06f76
commit
90227c0606
@@ -57,6 +57,15 @@ instance FromJSON RestoreBackupReq where
|
||||
restoreBackupPassword <- o .:? "password" .!= Nothing
|
||||
pure RestoreBackupReq { .. }
|
||||
|
||||
data DeleteDisksReq = DeleteDisksReq
|
||||
{ deleteDisksLogicalName :: Text
|
||||
} deriving (Eq, Show)
|
||||
instance FromJSON DeleteDisksReq where
|
||||
parseJSON = withObject "Eject Disk Req" $ \o -> do
|
||||
deleteDisksLogicalName <- o .: "logicalName"
|
||||
pure DeleteDisksReq { .. }
|
||||
|
||||
|
||||
-- Handlers
|
||||
|
||||
postCreateBackupR :: AppId -> Handler ()
|
||||
@@ -99,14 +108,7 @@ getDisksR :: Handler (JSONResponse [AppMgr.DiskInfo])
|
||||
getDisksR = fmap JSONResponse . runM . handleS9ErrC $ listDisksLogic
|
||||
|
||||
deleteDisksR :: Handler ()
|
||||
deleteDisksR = runM . handleS9ErrC $ do
|
||||
logicalName <- lookupGetParam "logicalName" >>= orThrow400
|
||||
ejectDiskLogic logicalName
|
||||
where
|
||||
orThrow400 = \case
|
||||
Nothing -> throwError $ ParamsE "logicalName"
|
||||
Just p -> pure p
|
||||
|
||||
deleteDisksR = runM . handleS9ErrC $ requireCheckJsonBody >>= ejectDiskLogic . deleteDisksLogicalName
|
||||
|
||||
-- Logic
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import { modulateTime } from 'src/app/util/misc.util'
|
||||
|
||||
@Injectable()
|
||||
export class LiveApiService extends ApiService {
|
||||
|
||||
constructor (
|
||||
private readonly http: HttpService,
|
||||
// TODO remove app + server model from here. updates to state should be done in a separate class wrapping ApiService + App/ServerModel
|
||||
@@ -63,7 +62,7 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
async ejectExternalDisk (logicalName: string): Promise<Unit> {
|
||||
return this.authRequest({ method: Method.DELETE, url: `/disks?logicalName=${encodeURIComponent(logicalName)}` })
|
||||
return this.authRequest({ method: Method.DELETE, url: `/disks`, data: { logicalName } })
|
||||
}
|
||||
|
||||
async updateAgent (version: string): Promise<Unit> {
|
||||
|
||||
Reference in New Issue
Block a user