2020-10-18 22:53:59 +03:00
|
|
|
import * as ViewerManager from "~/node_common/managers/viewer";
|
|
|
|
import * as Utilities from "~/node_common/utilities";
|
|
|
|
|
|
|
|
export default async (req, res) => {
|
|
|
|
const id = Utilities.getIdFromCookie(req);
|
|
|
|
if (!id) {
|
2021-03-07 23:53:54 +03:00
|
|
|
return res.status(401).send({ decorator: "SERVER_NOT_AUTHENTICATED", error: true });
|
2020-10-18 22:53:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const data = await ViewerManager.getDealHistory({ id });
|
|
|
|
|
|
|
|
if (!data) {
|
|
|
|
return res.status(500).send({
|
|
|
|
decorator: "SERVER_FILECOIN_NETWORK_DEALS_ERROR",
|
|
|
|
error: true,
|
|
|
|
data: null,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.status(200).send({ decorator: "SERVER_FILECOIN_NETWORK_DEALS", success: true, data });
|
|
|
|
};
|