interface: GCP skeleton

This commit is contained in:
J 2021-02-24 20:42:57 +00:00
parent 2a82da55ca
commit 94556ce936
6 changed files with 23 additions and 0 deletions

View 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
}
};

View File

@ -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);

View File

@ -71,6 +71,7 @@ export default class GlobalStore extends BaseStore<StoreState> {
},
weather: {},
userLocation: null,
gcp: {},
s3: {
configuration: {
buckets: new Set(),

View File

@ -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>;

View File

@ -0,0 +1,3 @@
export interface GcpState {
accessToken: string;
};

View File

@ -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();