Skip to content

Commit f17e24c

Browse files
authored
fix: set url to null instead of https when it is null (#5804)
1 parent b57e376 commit f17e24c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/components/widgets/forms/link-field.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { socialMediaExtraPrefixes } from 'open-event-frontend/utils/dictionary/s
66
interface Args {
77
prefix: string | undefined,
88
value: string | undefined,
9-
onChange: (text: string) => void
9+
onChange: (text: string | null) => void
1010
}
1111

1212
export default class LinkField extends Component<Args> {
@@ -35,7 +35,8 @@ export default class LinkField extends Component<Args> {
3535
/**
3636
* Final value with prefix to be sent to parent component
3737
*/
38-
get finalValue(): string {
38+
get finalValue(): string | null {
39+
if (!this.fixedValue && this.prefix === 'https://') {return null;}
3940
return this.prefix + this.fixedValue;
4041
}
4142

@@ -63,7 +64,8 @@ export default class LinkField extends Component<Args> {
6364
setValue(event: { target: HTMLInputElement }): void {
6465
const text = event.target.value;
6566
this.value = this.fixValue(text);
66-
this.args.onChange(this.finalValue);
67+
const finalUrl = this.value ? this.finalValue : null;
68+
this.args.onChange(finalUrl);
6769
}
6870

6971
@action

0 commit comments

Comments
 (0)