Add guard in createBucket within StorageExplorerStore

This commit is contained in:
Joshen Lim committed 2021-12-13 15:36:34 +07:00
1 parent 0e6bad7244
commit 52fa1a4e97
1 file changed
+7 -2
@@ -6,8 +6,9 @@ import {
compact,
isEqual,
isNull,
has,
isNil,
isUndefined,
has,
some,
chunk,
get,
@@ -376,11 +377,15 @@ class StorageExplorerStore {
/* Bucket CRUD */
createBucket = async (bucketName, isPublic = false) => {
if (isNil(this.supabaseClient)) {
return toast.error('Failed to initialize supabase client, try refreshing your browser.')
}
const { error } = await this.supabaseClient.storage.createBucket(bucketName, {
public: isPublic,
})
if (error) {
toast(error.message)
toast.error(error.message)
return this.closeCreateBucketModal()
}