Commit d4e517dc authored by Fabien Amarger's avatar Fabien Amarger

WIP: feat(prefix): Get prefixed URI from prefix.cc

parent 42cda3ee9345
Pipeline #64097 failed with stages
in 53 seconds
......@@ -19,3 +19,4 @@ export interface ViewDescription {
}
export {ViewWrapper} from './ViewWrapper';
export {prefixedNameFromUri} from './prefix';
export async function prefixedNameFromUri(uri: string): Promise<string> {
const resp = await fetch(
`http://prefix.cc/reverse?uri=${encodeURIComponent(uri)}`
);
let prefixedUri = uri;
if (resp.statusText === 'OK') {
// remove "http://prefix.cc/" from the url to get the prefixed URI
prefixedUri = resp.url.substring(resp.url.lastIndexOf('/') + 1);
}
return prefixedUri;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment