update to mine api for as to be passed in to the functions
This commit is contained in:
parent
022837de87
commit
9b9f4cdf63
9 changed files with 50 additions and 34 deletions
|
|
@ -8,6 +8,7 @@ import {
|
|||
import ResponsiveDialog from "common/ResponsiveDialog";
|
||||
import { useMineAPI } from "hooks";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useGlobalState } from "providers";
|
||||
import { useState } from "react";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -20,11 +21,12 @@ export default function AddMine(props: Props) {
|
|||
const { open, closeCallback, refreshCallback } = props;
|
||||
const [name, setName] = useState("");
|
||||
const mineAPI = useMineAPI();
|
||||
const [{as}] = useGlobalState();
|
||||
|
||||
const addMine = () => {
|
||||
let newMine = pond.MineSettings.create();
|
||||
newMine.name = name;
|
||||
mineAPI.addMine(newMine).finally(() => {
|
||||
mineAPI.addMine(newMine, as).finally(() => {
|
||||
closeCallback();
|
||||
refreshCallback();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue