run linter + wire up checkout

This commit is contained in:
Adam Millerchip 2023-04-15 01:50:13 +09:00
parent 28bbc93f2b
commit e56b46e889
4 changed files with 18 additions and 18 deletions

View File

@ -1,5 +1,5 @@
import {Command} from '@oclif/core'
import {tokenFlags} from '../tokenFlags'
import {tokenFlags} from '../token-flags'
import {checkin} from '../kingoftime'
export default class Checkout extends Command {

View File

@ -1,5 +1,6 @@
import {Command, Flags} from '@oclif/core'
import {tokenFlags} from '../tokenFlags'
import {Command} from '@oclif/core'
import {tokenFlags} from '../token-flags'
import {checkout} from '../kingoftime'
export default class Checkout extends Command {
static description = 'Check out'
@ -12,7 +13,6 @@ export default class Checkout extends Command {
public async run(): Promise<void> {
const {flags} = await this.parse(Checkout)
console.log(`token: ${flags.token}`)
console.log(`userToken: ${flags.userToken}`)
await checkout(flags.token, flags['user-token'])
}
}

View File

@ -1,4 +1,4 @@
import axios from 'axios';
import axios from 'axios'
const CHECK_IN_ID = 'qmXXCxw9WEWN3X/YrkMWuQ=='
const CHECK_OUT_ID = 'j8ekmJaw6W3M4w3i6hlSIQ=='
@ -6,19 +6,19 @@ const CHECK_OUT_ID = 'j8ekmJaw6W3M4w3i6hlSIQ=='
async function kingoftime(operationId: string, token: string, userToken: string) {
const response = await axios({
method: 'post',
//url: 'https://s2.kingtime.jp/gateway/bprgateway',
// url: 'https://s2.kingtime.jp/gateway/bprgateway',
url: 'https://httpbin.org/anything',
headers: {
'Accept': 'application/json, text/javascript, */*; q=0.01'
Accept: 'application/json, text/javascript, */*; q=0.01',
},
data: new URLSearchParams({
'id': operationId,
'highAccuracyFlg': 'false',
'credential_code': '40',
'user_token': userToken,
'version': '1.4.2',
'token': token
})
id: operationId,
highAccuracyFlg: 'false',
credential_code: '40', // eslint-disable-line camelcase
user_token: userToken, // eslint-disable-line camelcase
version: '1.4.2',
token: token,
}),
})
console.log(response.data)
}

View File

@ -7,11 +7,11 @@ export const tokenFlags = {
token: Flags.string({
env: tokenVar,
description: `Defaults to the ${tokenVar} environment variable.`,
required: true
required: true,
}),
'user-token': Flags.string({
env: userTokenVar,
description: `Defaults to the ${userTokenVar} environment variable.`,
required: true
})
required: true,
}),
}