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,14 +201,14 @@ 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),
]); ]);
@ -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();
} }