[fix] profile issue

This commit is contained in:
smadpro 2022-05-16 03:53:46 +04:30
parent 6d82b4a420
commit d408c139a9
2 changed files with 9 additions and 10 deletions

View File

@ -201,16 +201,16 @@ const ProfileJsx = ({ navigation }) => {
"@user_instance", "@user_instance",
"@user_token", "@user_token",
]) ])
.then(([profilePair, notifPair, domainPair, tokenPair]) => { .then(async([profilePair, notifPair, domainPair, tokenPair]) => {
profile = JSON.parse(profilePair[1]); profile = JSON.parse(profilePair[1]);
notifs = JSON.parse(notifPair[1]); notifs = JSON.parse(notifPair[1]);
domain = domainPair[1]; domain = domainPair[1];
accessToken = JSON.parse(tokenPair[1]).access_token; accessToken = JSON.parse(tokenPair[1]).access_token;
return Promise.all([ return Promise.all([
requests.fetchProfile(domain, profile.id), requests.fetchProfile(domain, profile.id,accessToken),
requests.fetchAccountStatuses(domain, profile.id, accessToken), requests.fetchAccountStatuses(domain, profile.id, accessToken),
requests.fetchFollowers(domain, profile.id, accessToken), requests.fetchFollowers(domain, profile.id, accessToken),
]); ]);
}) })
.then(([latestProfile, posts, followers]) => { .then(([latestProfile, posts, followers]) => {
@ -231,7 +231,6 @@ const ProfileJsx = ({ navigation }) => {
<> <>
{ state.loaded { state.loaded
? <ScreenWithTrayJsx ? <ScreenWithTrayJsx
active = "Profile"
navigation = { navigation } navigation = { navigation }
active = "Profile"> active = "Profile">
<RawProfileJsx <RawProfileJsx

View File

@ -66,7 +66,7 @@ export async function post(url, token = false) {
return resp; return resp;
} }
export async function get(url, token = false, data = false) { export async function get(url, token , data = false) {
let completeURL; let completeURL;
if (data) { if (data) {
let params = new URLSearchParams(data); let params = new URLSearchParams(data);
@ -85,7 +85,7 @@ export async function get(url, token = false, data = false) {
return resp; return resp;
} }
export async function _delete(url, token = false) { export async function _delete(url, token) {
const resp = await fetch(url, { const resp = await fetch(url, {
method: "DELETE", method: "DELETE",
headers: token headers: token
@ -96,8 +96,8 @@ export async function _delete(url, token = false) {
return resp; return resp;
} }
export async function fetchProfile(domain, id) { export async function fetchProfile(domain, id, token) {
const resp = await get(`https://${domain}/api/v1/accounts/${id}`); const resp = await get(`https://${domain}/api/v1/accounts/${id}`,token);
return resp.json(); return resp.json();
} }