import axios from 'axios'; import React, { useState } from 'react' import { Row, Card, Form, Button, FloatingLabel } from 'react-bootstrap'; import Swal from 'sweetalert2'; import { routesClient } from './../routesClient'; function NicknameChange() { const cardstyled = { margin: 'auto', padding: '1em', display: 'flex', justifyContent: 'center', width: '100%', borderWidth: '3px', borderRadius: '20px', borderColor: 'rgb(110, 189, 142)', color: '#04AB70' } const inboxstyled = { display: 'flex', flexDirection: 'column', maxWidth: '80%', justifyContent: 'center', margin: 'auto', padding: '0.5em', color: 'black' } const [inputname, setInputname] = useState('') function handleChange({ target: { value } }) { setInputname(value) } async function handleSubmit(event) { event.preventDefault(); if (inputname !== '') { await axios.post(routesClient.edit, { nick_name: inputname }) .then(function (response) { console.log(response.data.msg); if (response.data.msg === 'OK!') { Swal.fire({ title: '변경되었습니다.', text: '축하드립니다!👏', icon: 'success', customClass: 'swal-wide', confirmButtonText: '확인', }).then(function (response) { if (response.isConfirmed) { window.location.reload() } }) } else { console.log(response.data.msg); } }) } }; return ( 닉네임 변경 새로운 닉네임으로 변경해보세요
) } export default NicknameChange;