update user files info
This commit is contained in:
@@ -28,4 +28,37 @@ export async function getUserData() {
|
||||
} catch (error) {
|
||||
console.error('error');
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserFilesInfo() {
|
||||
const token = await getSessionData('token');
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
version: 1,
|
||||
msg_id: 20005,
|
||||
message_body: {
|
||||
action: "user_files_info",
|
||||
token: token
|
||||
}
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const parsed = await response.json();
|
||||
if (parsed.message_code === 0) {
|
||||
return parsed.message_body;
|
||||
} else {
|
||||
throw parsed.message_code;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`error: ${error}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user