Initial commit: Premier Gunner tracker + StartOS 0.4.0 s9pk package
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { store } from '../fileModels/store'
|
||||
import { i18n } from '../i18n'
|
||||
import { sdk } from '../sdk'
|
||||
|
||||
const { InputSpec, Value } = sdk
|
||||
|
||||
const inputSpec = InputSpec.of({
|
||||
password: Value.text({
|
||||
name: i18n('Password'),
|
||||
description: i18n(
|
||||
'The password Gunner types on the login screen (at least 4 characters)',
|
||||
),
|
||||
required: true,
|
||||
default: null,
|
||||
masked: true,
|
||||
minLength: 4,
|
||||
}),
|
||||
})
|
||||
|
||||
export const setPassword = sdk.Action.withInput(
|
||||
'set-password',
|
||||
|
||||
async ({ effects }) => ({
|
||||
name: i18n('Set Login Password'),
|
||||
description: i18n('Set the password Gunner uses to log in to Premier Gunner'),
|
||||
warning: null,
|
||||
allowedStatuses: 'any',
|
||||
group: null,
|
||||
visibility: 'enabled',
|
||||
}),
|
||||
|
||||
inputSpec,
|
||||
|
||||
async ({ effects }) => {
|
||||
const password = await store.read((s) => s.password).const(effects)
|
||||
return { password: password ?? undefined }
|
||||
},
|
||||
|
||||
async ({ effects, input }) => {
|
||||
await store.merge(effects, { password: input.password })
|
||||
},
|
||||
)
|
||||
|
||||
export const actions = sdk.Actions.of().addAction(setPassword)
|
||||
Reference in New Issue
Block a user