-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataStorage.js
More file actions
65 lines (51 loc) · 1.37 KB
/
DataStorage.js
File metadata and controls
65 lines (51 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as firebase from 'firebase';
import { SecureStore } from 'expo';
class DataStorage {
static EMAIL;
static FULL_NAME;
static PHONE_NUM;
static IS_LAWYER;
// Laywer specific information
static EXP;
static DEGREE;
static SPECIALTY;
// Client specific information
static LOCATION;
static async saveLogin(email, password) {
console.log('Trying to save login....');
let savableEmail = email.substring(0, email.indexOf('@')) + '-at_' + email.substring(email.indexOf('@') + 1, email.length);
// Save email for login
SecureStore.setItemAsync('lastUser', savableEmail)
.then(() => {
// Save password
SecureStore.setItemAsync('password', password)
.then(() => {
console.log('Successfully saved email and pass');
})
.catch((error) => {
alert('Expo Error: ' + error.message);
})
})
.catch((error) => {
alert('Expo Error: ' + error.message);
})
}
static loadProfileData() {
const uid = firebase.auth().currentUser.uid;
// Load lawyer data
if (this.IS_LAWYER) {
} else {
}
}
static clearData() {
this.EMAIL = '';
this.FULL_NAME = '';
this.PHONE_NUM = '';
this.IS_LAWYER = '';
this.EXP = '';
this.DEGREE = '';
this.SPECIALTY = '';
this.LOCATION = '';
}
}
export default DataStorage;