【问题标题】:Storage.get AWS => How to return url in react component?Storage.get AWS => 如何在反应组件中返回 url?
【发布时间】:2018-08-10 11:42:02
【问题描述】:

我想返回存储在 aws 中的文件的 url,但我不擅长承诺...

Storage.get('sounds/feel the rythm_2.mp3', {level: 'private'})
.then(result => console.log(result))

但是这里它只是返回控制台中的url,我想返回它

谢谢

【问题讨论】:

    标签: es6-promise aws-amplify


    【解决方案1】:

    只是从 Promise 中返回值

    Storage.get('sounds/feel the rythm_2.mp3', { level: 'private' })
      .then(result => {
        console.log(result);
    
        return result; // return value from promise
      });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-14
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 2019-02-15
      • 1970-01-01
      • 2021-02-03
      • 2018-08-09
      相关资源
      最近更新 更多