import React from "react";
import { Form, Input, Button } from "antd";

import axios from "axios";

export const FormCreateRoom = () => {
  const [form] = Form.useForm();

  const onFinish = async (values) => {
      let response = await createRoom(values);
      if (response?.status >= 200 && response?.status < 300) {
          window.location.reload();
      }
  };

  return (
    <Form form={form} onFinish={onFinish}>
      <Form.Item
        label="Room Name"
        name="name"
        rules={[{ required: true, message: "Please input the room name!" }]}
      >
        <Input />
      </Form.Item>
      <Form.Item>
        <Button type="primary" htmlType="submit">
          Submit
        </Button>
      </Form.Item>
    </Form>
  );
};

export default FormCreateRoom;
