mirror of
https://github.com/tloncorp/landscape.git
synced 2024-12-01 02:45:49 +03:00
storage: use correct keys
This commit is contained in:
parent
78277155fb
commit
a137ab6451
@ -21,7 +21,7 @@
|
||||
|= upd=update
|
||||
^- json
|
||||
=, format
|
||||
%+ frond:enjs %s3-update
|
||||
%+ frond:enjs %storage-update
|
||||
%- pairs:enjs
|
||||
:~ ?- -.upd
|
||||
%set-current-bucket [%'setCurrentBucket' s+bucket.upd]
|
||||
|
@ -92,8 +92,8 @@ export interface StorageUpdateCredentials {
|
||||
|
||||
export interface StorageUpdateConfiguration {
|
||||
configuration: {
|
||||
buckets: string[];
|
||||
currentBucket: string;
|
||||
buckets: string[];
|
||||
currentBucket: string;
|
||||
};
|
||||
}
|
||||
|
||||
@ -125,4 +125,13 @@ export interface StorageUpdateRegion {
|
||||
setRegion: string;
|
||||
}
|
||||
|
||||
export declare type StorageUpdate = StorageUpdateCredentials | StorageUpdateConfiguration | StorageUpdateCurrentBucket | StorageUpdateAddBucket | StorageUpdateRemoveBucket | StorageUpdateEndpoint | StorageUpdateAccessKeyId | StorageUpdateSecretAccessKey | StorageUpdateRegion;
|
||||
export declare type StorageUpdate =
|
||||
| StorageUpdateCredentials
|
||||
| StorageUpdateConfiguration
|
||||
| StorageUpdateCurrentBucket
|
||||
| StorageUpdateAddBucket
|
||||
| StorageUpdateRemoveBucket
|
||||
| StorageUpdateEndpoint
|
||||
| StorageUpdateAccessKeyId
|
||||
| StorageUpdateSecretAccessKey
|
||||
| StorageUpdateRegion;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import _ from 'lodash';
|
||||
import { enableMapSet } from 'immer';
|
||||
import { BaseStorageState } from '@/gear';
|
||||
import { BaseStorageState, StorageUpdate } from '@/gear';
|
||||
import reduce from './reducer';
|
||||
import {
|
||||
createState,
|
||||
@ -32,15 +32,19 @@ export const useStorage = createState<BaseStorageState>(
|
||||
{},
|
||||
[
|
||||
(set, get) =>
|
||||
createSubscription('storage', '/all', (e) => {
|
||||
const data = _.get(e, 'storage-update', false);
|
||||
if (data) {
|
||||
reduceStateN(get(), data, reduce);
|
||||
createSubscription(
|
||||
'storage',
|
||||
'/all',
|
||||
(e: { 'storage-update': StorageUpdate }) => {
|
||||
const data = _.get(e, 'storage-update', false);
|
||||
if (data) {
|
||||
reduceStateN(get(), data, reduce);
|
||||
}
|
||||
numLoads += 1;
|
||||
if (numLoads === 2) {
|
||||
set({ loaded: true });
|
||||
}
|
||||
}
|
||||
numLoads += 1;
|
||||
if (numLoads === 2) {
|
||||
set({ loaded: true });
|
||||
}
|
||||
}),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user