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

export const actions = {
  default: async ({ cookies, request }) => {
    let id;
    let body = await fd(request);

    try {
      ({ id } = await post("/mint", body, auth(cookies)));
    } catch (e) {
      console.log("problem creating ecash", e);
      error(400, { message: e.message });
    }

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