mirror of
https://github.com/balzack/databag.git
synced 2025-04-23 18:15:19 +00:00
fixing account reset flow
This commit is contained in:
parent
34e382ae72
commit
8f8c2f30ae
@ -72,12 +72,14 @@ export function useAppContext() {
|
||||
},
|
||||
access: async (server, token) => {
|
||||
const access = await setAccountAccess(server, token);
|
||||
console.log("ACCESS", access);
|
||||
await store.actions.setSession({ ...access, server});
|
||||
await setSession({ ...access, server });
|
||||
},
|
||||
login: async (username, password) => {
|
||||
const acc = username.split('@');
|
||||
const access = await setLogin(acc[0], acc[1], password)
|
||||
console.log("ACCESS2", access);
|
||||
await store.actions.setSession({ ...access, server: acc[1]});
|
||||
await setSession({ ...access, server: acc[1] });
|
||||
},
|
||||
@ -111,7 +113,6 @@ export function useAppContext() {
|
||||
}
|
||||
ws.current.onclose = (e) => {
|
||||
count.current += 1;
|
||||
console.log("CURRENT1: ", count.current);
|
||||
updateState({ disconnected: count.current });
|
||||
console.log(e)
|
||||
setTimeout(() => {
|
||||
@ -129,7 +130,6 @@ console.log("CURRENT1: ", count.current);
|
||||
}
|
||||
ws.current.error = (e) => {
|
||||
count.current += 1;
|
||||
console.log("CURRENT2: ", count.current);
|
||||
updateState({ disconnected: count.current });
|
||||
console.log(e)
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useEffect, useState, useRef, useContext } from 'react';
|
||||
import SQLite from "react-native-sqlite-storage";
|
||||
|
||||
const DATABAG_DB = 'databag_v042.db';
|
||||
const DATABAG_DB = 'databag_v044.db';
|
||||
|
||||
export function useStoreContext() {
|
||||
const [state, setState] = useState({});
|
||||
|
@ -14,6 +14,9 @@ export function Dashboard(props) {
|
||||
const { config, server, token } = location.state;
|
||||
const { state, actions } = useDashboard(config, server, token);
|
||||
|
||||
console.log(state.createToken);
|
||||
console.log(state.accessToken);
|
||||
|
||||
const saveConfig = async () => {
|
||||
try {
|
||||
await actions.saveConfig();
|
||||
@ -256,7 +259,7 @@ export function Dashboard(props) {
|
||||
</View>
|
||||
<View style={styles.accessToken}>
|
||||
<Text style={styles.tokenLabel}>Token:</Text>
|
||||
<TouchableOpacity style={styles.copy}>
|
||||
<TouchableOpacity style={styles.copy} onPress={() => Clipboard.setString(state.accessToken)}>
|
||||
<Text style={styles.token}>{ state.accessToken }</Text>
|
||||
<AntIcon style={styles.icon} name={'copy1'} size={20} />
|
||||
</TouchableOpacity>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { View, StatusBar, TouchableOpacity, Text } from 'react-native';
|
||||
import { View, TouchableOpacity, StatusBar, Text } from 'react-native';
|
||||
import { useState, useEffect, useContext } from 'react';
|
||||
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { useState, useEffect, useContext } from 'react';
|
||||
import { CardContext } from 'context/CardContext';
|
||||
import { AppContext } from 'context/AppContext';
|
||||
|
||||
export function useCardsIcon(active) {
|
||||
|
||||
@ -8,6 +9,7 @@ export function useCardsIcon(active) {
|
||||
setRevision: null,
|
||||
});
|
||||
|
||||
const app = useContext(AppContext);
|
||||
const card = useContext(CardContext);
|
||||
|
||||
const updateState = (value) => {
|
||||
@ -23,9 +25,11 @@ export function useCardsIcon(active) {
|
||||
useEffect(() => {
|
||||
let revision;
|
||||
card.state.cards.forEach((contact) => {
|
||||
if (contact?.detail?.status === 'pending' || contact?.detail?.status === 'requested') {
|
||||
if (!revision || contact.detailRevision > revision) {
|
||||
revision = contact.detailRevision;
|
||||
if (contact?.detail?.statusUpdated > app.state.loginTimestamp) {
|
||||
if (contact?.detail?.status === 'pending' || contact?.detail?.status === 'requested') {
|
||||
if (!revision || contact.detailRevision > revision) {
|
||||
revision = contact.detailRevision;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -33,7 +37,6 @@ export function useCardsIcon(active) {
|
||||
card.actions.setRequestRevision(state.curRevision);
|
||||
}
|
||||
updateState({ setRevision: card.state.requestRevision, curRevision: revision });
|
||||
|
||||
}, [card]);
|
||||
|
||||
const actions = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user