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

View File

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