fix(ui): fix payload for single variant fflag
This commit is contained in:
parent
0e5b01e47d
commit
c6ff06838a
2 changed files with 7 additions and 0 deletions
|
|
@ -149,8 +149,13 @@ function NewFFlag({ siteId, fflagId }: { siteId: string; fflagId?: string }) {
|
|||
<div className={'mt-6'}>
|
||||
<Payload />
|
||||
<Input
|
||||
value={current.payload ?? ''}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
current.setPayload(e.target.value);
|
||||
}}
|
||||
placeholder={"E.g. red button, {'buttonColor': 'red'}"}
|
||||
className={'mt-2'}
|
||||
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ export default class FeatureFlag {
|
|||
initData,
|
||||
{
|
||||
...data,
|
||||
payload: data?.payload === null ? '' : data?.payload,
|
||||
isSingleOption: data ? data.flagType === 'single' : true,
|
||||
conditions: data?.conditions?.map(c => new Conditions(c)) || [new Conditions()],
|
||||
variants: data?.flagType === 'multi' ? data?.variants?.map((v, i) => new Variant(i, v)) : [],
|
||||
|
|
@ -154,6 +155,7 @@ export default class FeatureFlag {
|
|||
updatedAt: this.updatedAt,
|
||||
isActive: this.isActive,
|
||||
description: this.description,
|
||||
payload: this.payload,
|
||||
isPersist: this.isPersist,
|
||||
flagType: this.isSingleOption ? 'single' as const : 'multi' as const,
|
||||
featureFlagId: this.featureFlagId,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue