mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2025-12-22 00:54:21 +01:00
feat: add list method
Adds list method. Adds put, get & list examples to README.md. Bump package version to 0.6.0.
This commit is contained in:
@@ -212,3 +212,15 @@ export async function resolveHttps(
|
||||
return err(JSON.stringify(e));
|
||||
}
|
||||
}
|
||||
|
||||
export async function list(url: string): Promise<Result<string[]>> {
|
||||
try {
|
||||
const res = await Pubky.list(url);
|
||||
if (res[0] === 'error') {
|
||||
return err(res[1]);
|
||||
}
|
||||
return ok(JSON.parse(res[1]));
|
||||
} catch (e) {
|
||||
return err(JSON.stringify(e));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user