Move to git.themmonk.com
This commit is contained in:
0
web/js/api/auth.js
Normal file
0
web/js/api/auth.js
Normal file
22
web/js/api/libraries.js
Normal file
22
web/js/api/libraries.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as auth from '/web/js/api/auth.js';
|
||||
import ky from 'https://cdn.jsdelivr.net/npm/ky@1.14.1/+esm'
|
||||
|
||||
export async function ls(library, path) {
|
||||
try {
|
||||
const response = await ky.get(`/libraries/${library}/${path}`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${auth.ACCESS_TOKEN}`,
|
||||
},
|
||||
}).json();
|
||||
|
||||
return response;
|
||||
|
||||
} catch (err) {
|
||||
if (err.response) {
|
||||
console.error('Unexpected HTTP status code', err.response.status);
|
||||
} else {
|
||||
console.error(err);
|
||||
}
|
||||
return "err";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user