mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 21:01:31 +03:00
Fixed clean start issues
This commit is contained in:
parent
09f72278f6
commit
a58d7729e8
@ -199,8 +199,11 @@ export const getUserData = async () => {
|
|||||||
export const getUserDataWithUsername = async username => {
|
export const getUserDataWithUsername = async username => {
|
||||||
try {
|
try {
|
||||||
const user = await getItemFromStorage(USER_SCHEMA);
|
const user = await getItemFromStorage(USER_SCHEMA);
|
||||||
const userObj = user.filter(u => u.username === username);
|
if (user) {
|
||||||
return userObj;
|
const userObj = user.filter(u => u.username === username);
|
||||||
|
return userObj;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -209,7 +212,7 @@ export const getUserDataWithUsername = async username => {
|
|||||||
export const setUserData = async userData => {
|
export const setUserData = async userData => {
|
||||||
try {
|
try {
|
||||||
const account = await getUserDataWithUsername(userData.username);
|
const account = await getUserDataWithUsername(userData.username);
|
||||||
const user = await getItemFromStorage(USER_SCHEMA);
|
const user = (await getItemFromStorage(USER_SCHEMA)) || [];
|
||||||
|
|
||||||
if (account.length === 0) {
|
if (account.length === 0) {
|
||||||
user.push(userData);
|
user.push(userData);
|
||||||
@ -607,7 +610,23 @@ export const getSettings = async () => {
|
|||||||
if (setting) {
|
if (setting) {
|
||||||
return setting;
|
return setting;
|
||||||
}
|
}
|
||||||
return false;
|
const settingData = {
|
||||||
|
language: '',
|
||||||
|
isDarkTheme: false,
|
||||||
|
currency: '',
|
||||||
|
notification: true,
|
||||||
|
server: '',
|
||||||
|
upvotePercent: '1',
|
||||||
|
nsfw: '0',
|
||||||
|
followNotification: true,
|
||||||
|
voteNotification: true,
|
||||||
|
commentNotification: true,
|
||||||
|
mentionNotification: true,
|
||||||
|
reblogNotification: true,
|
||||||
|
transfersNotification: true,
|
||||||
|
};
|
||||||
|
await setItemToStorage(SETTINGS_SCHEMA, settingData);
|
||||||
|
return settingData;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user