mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 08:13:28 +03:00
Refactor of components (#5499)
This commit is contained in:
committed by
Harshavardhana
parent
9ab6a8035f
commit
feb726dd98
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import web from "../web"
|
||||
import history from "../history"
|
||||
|
||||
export const SET_LIST = "buckets/SET_LIST"
|
||||
export const SET_FILTER = "buckets/SET_FILTER"
|
||||
@@ -25,6 +26,9 @@ export const fetchBuckets = () => {
|
||||
return web.ListBuckets().then(res => {
|
||||
const buckets = res.buckets ? res.buckets.map(bucket => bucket.name) : []
|
||||
dispatch(setList(buckets))
|
||||
if (buckets.length > 0) {
|
||||
dispatch(selectBucket(buckets[0]))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -43,6 +47,13 @@ export const setFilter = filter => {
|
||||
}
|
||||
}
|
||||
|
||||
export const selectBucket = bucket => {
|
||||
return function(dispatch) {
|
||||
dispatch(setCurrentBucket(bucket))
|
||||
history.push(`/${bucket}`)
|
||||
}
|
||||
}
|
||||
|
||||
export const setCurrentBucket = bucket => {
|
||||
return {
|
||||
type: SET_CURRENT_BUCKET,
|
||||
|
||||
Reference in New Issue
Block a user