"use strict";
/*
Unstar a public path

- id of the public path
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const star_1 = require("@cocalc/server/public-paths/star");
const get_account_1 = __importDefault(require("lib/account/get-account"));
const get_params_1 = __importDefault(require("lib/api/get-params"));
async function handle(req, res) {
    try {
        const account_id = await (0, get_account_1.default)(req);
        if (account_id == null) {
            throw Error("must be signed in to unstar");
        }
        const { id } = (0, get_params_1.default)(req);
        if (!id) {
            throw Error("must specify id of public path");
        }
        await (0, star_1.unstar)(id, account_id);
        res.json({});
    }
    catch (err) {
        res.json({ error: `${err.message}` });
        return;
    }
}
exports.default = handle;
//# sourceMappingURL=unstar.js.map