mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
interface: GCP skeleton
This commit is contained in:
parent
2a82da55ca
commit
94556ce936
14
pkg/interface/src/logic/api/gcp.ts
Normal file
14
pkg/interface/src/logic/api/gcp.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import BaseApi from './base';
|
||||
import {StoreState} from '../store/type';
|
||||
|
||||
|
||||
export default class GcpApi extends BaseApi<StoreState> {
|
||||
startRefreshLoop() {
|
||||
this.refreshToken();
|
||||
}
|
||||
|
||||
private refreshToken() {
|
||||
const res = this.spider('noun', 'gcp-token', 'get-gcp-token', {});
|
||||
// TODO: store the token, set a timer to refresh it
|
||||
}
|
||||
};
|
@ -10,6 +10,7 @@ import GroupsApi from './groups';
|
||||
import LaunchApi from './launch';
|
||||
import GraphApi from './graph';
|
||||
import S3Api from './s3';
|
||||
import GcpApi from './gcp';
|
||||
import {HarkApi} from './hark';
|
||||
import SettingsApi from './settings';
|
||||
|
||||
@ -20,6 +21,7 @@ export default class GlobalApi extends BaseApi<StoreState> {
|
||||
contacts = new ContactsApi(this.ship, this.channel, this.store);
|
||||
groups = new GroupsApi(this.ship, this.channel, this.store);
|
||||
launch = new LaunchApi(this.ship, this.channel, this.store);
|
||||
gcp = new GcpApi(this.ship, this.channel, this.store);
|
||||
s3 = new S3Api(this.ship, this.channel, this.store);
|
||||
graph = new GraphApi(this.ship, this.channel, this.store);
|
||||
hark = new HarkApi(this.ship, this.channel, this.store);
|
||||
|
@ -71,6 +71,7 @@ export default class GlobalStore extends BaseStore<StoreState> {
|
||||
},
|
||||
weather: {},
|
||||
userLocation: null,
|
||||
gcp: {},
|
||||
s3: {
|
||||
configuration: {
|
||||
buckets: new Set(),
|
||||
|
@ -3,6 +3,7 @@ import { Invites } from '~/types/invite-update';
|
||||
import { Associations } from '~/types/metadata-update';
|
||||
import { Rolodex } from '~/types/contact-update';
|
||||
import { Groups } from '~/types/group-update';
|
||||
import { GcpState } from '~/types/gcp-state';
|
||||
import { S3State } from '~/types/s3-update';
|
||||
import { LaunchState, WeatherState } from '~/types/launch-update';
|
||||
import { ConnectionStatus } from '~/types/connection';
|
||||
@ -32,6 +33,7 @@ export interface StoreState {
|
||||
groupKeys: Set<Path>;
|
||||
nackedContacts: Set<Patp>
|
||||
s3: S3State;
|
||||
gcp: GcpState;
|
||||
graphs: Graphs;
|
||||
graphKeys: Set<string>;
|
||||
|
||||
|
3
pkg/interface/src/types/gcp-state.ts
Normal file
3
pkg/interface/src/types/gcp-state.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface GcpState {
|
||||
accessToken: string;
|
||||
};
|
@ -94,6 +94,7 @@ class App extends React.Component {
|
||||
// before the app has actually rendered, hence the timeout.
|
||||
this.updateTheme(this.themeWatcher);
|
||||
}, 500);
|
||||
this.api.gcp.startRefreshLoop();
|
||||
this.api.local.getBaseHash();
|
||||
this.api.settings.getAll();
|
||||
this.store.rehydrate();
|
||||
|
Loading…
Reference in New Issue
Block a user