Merge pull request #163 from filecoin-project/andrew/switch-to-new-init

fix(api): use newer getOrInit method
This commit is contained in:
CAKE 2020-08-19 14:30:00 -07:00 committed by GitHub
commit 1513693d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,9 +70,9 @@ export const getBucketAPIFromUserToken = async (token) => {
const identity = await PrivateKey.fromString(token); const identity = await PrivateKey.fromString(token);
const buckets = await Buckets.withKeyInfo(TEXTILE_KEY_INFO); const buckets = await Buckets.withKeyInfo(TEXTILE_KEY_INFO);
await buckets.getToken(identity); await buckets.getToken(identity);
const root = await buckets.open(BUCKET_NAME); const target = await buckets.getOrInit(BUCKET_NAME);
return { buckets, bucketKey: root.key, bucketName: BUCKET_NAME }; return { buckets, bucketKey: target.root.key, bucketName: BUCKET_NAME };
}; };
// NOTE(jim): Requires Powergate, does not require token. // NOTE(jim): Requires Powergate, does not require token.