mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-26 04:19:49 +03:00
feat(actions/createLink):
- returnJSON will return {aborted: true} as a response when the fetch is aborted - pass options argument to extend createLink's request options
This commit is contained in:
parent
95900d3e1e
commit
2220ba8941
@ -44,6 +44,7 @@ const returnJSON = async (route, options) => {
|
||||
|
||||
return json;
|
||||
} catch (e) {
|
||||
if (e.name === "AbortError") return { aborted: true };
|
||||
Logging.error(e);
|
||||
}
|
||||
};
|
||||
@ -223,11 +224,12 @@ export const createFile = async (data) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const createLink = async (data) => {
|
||||
export const createLink = async (data, options) => {
|
||||
await Websockets.checkWebsocket();
|
||||
return await returnJSON(`/api/data/create-link`, {
|
||||
...DEFAULT_OPTIONS,
|
||||
body: JSON.stringify({ data }),
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user