Skip to content

Using storage relationship in component blocks #9192

Answered by iNetJoJo
iNetJoJo asked this question in Questions
Discussion options

You must be logged in to vote

solved. i added virtual field to Image

Image: list({
        access: allowAll,
        fields: {
            name: text({
                validation: {isRequired: true},
            }),
            altText: text(),
            image: image({
                storage: "digital_ocean_spaces"
            }),
            image_url: virtual({
                field: graphql.field({
                    type: graphql.String,
                    resolve(item) {
                        return `${process.env.ASSET_BASE_URL}/${item.image_id}.${item.image_extension}`;
                    }
                })
            })
        }
    })
    ```
    
    and now i can use it in component like this
    

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dcousens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant