aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send/ecash/+page.server.js
blob: 422e5a304f8f4b25a99ce023f06c95fdc3f5cfbf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { fail, redirect } from "@sveltejs/kit";
import { auth, post, fd } from "$lib/utils";

export const actions = {
  default: async ({ cookies, request }) => {
    let id;
    try {
      let body = await fd(request);
      ({ id } = await post("/mint", body, auth(cookies)));
    } catch (e) {
      console.log("problem creating ecash", e);
      return fail(400, { message: e.message });
    }

    redirect(307, `/ecash/${id}`);
  },
};