import React from 'react'; import PopupBase from '../PopupBase'; import style from './NewActorPopup.module.css'; import {APINode, callAPI} from '../../../utils/Api'; import {GeneralSuccess} from '../../../types/GeneralTypes'; interface NewActorPopupProps { onHide: () => void; } /** * creates modal overlay to define a new Tag */ class NewActorPopup extends React.Component { render(): JSX.Element { return ( ); } } export class NewActorPopupContent extends React.Component { value: string | undefined; render(): JSX.Element { return ( <>
{ this.value = v.target.value; }} />
); } /** * store the filled in form to the backend */ storeselection(): void { // check if user typed in name if (this.value === '' || this.value === undefined) { return; } callAPI(APINode.Actor, {action: 'createActor', actorname: this.value}, (result: GeneralSuccess) => { if (result.result !== 'success') { console.log('error occured while writing to db -- todo error handling'); console.log(result.result); } this.props.onHide(); }); } } export default NewActorPopup;