Merge pull request #42 from smdpro/issue-41

profile page issue was fixed
This commit is contained in:
Nat 2022-05-19 11:54:22 -07:00 committed by GitHub
commit 68b6622cc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();
}