wishlist-client/components/domain/wishes/models.ts
kjuulh 28069a92f1
Some checks failed
continuous-integration/drone/push Build is failing
Created logic for creating lists
2022-04-25 22:32:24 +02:00

27 lines
479 B
TypeScript

import { result } from '../../common/result'
export type Wish = {
id: string
name: string
description?: string
link?: string
}
export const createWish = (
id: string,
name: string,
description: string = '',
link: string = ''
): result.Result<Wish, string> => {
if (typeof name !== 'undefined') {
return result.ok({
id,
name,
description,
link,
} as Wish)
}
return result.err(`validation of wish failed via. createWish`)
}