Commit a9178ff7 authored by Ли Джен Сеп's avatar Ли Джен Сеп 💬

#5 Добавил удаление пробелов

parent 6ed9bec4
...@@ -40,10 +40,7 @@ export default function InputField({ name, value, onChange }: Props) { ...@@ -40,10 +40,7 @@ export default function InputField({ name, value, onChange }: Props) {
</Typography> </Typography>
</Grid2> </Grid2>
<Grid2 <Grid2 size={name === "Password" ? 6 : 8} sx={{ "@media (max-width: 900px)": { width: "100%" } }}>
size={name === "Password" ? 6 : 8}
sx={{ "@media (max-width: 900px)": { width: "100%" } }}
>
<TextField <TextField
fullWidth fullWidth
multiline={name !== "Password"} multiline={name !== "Password"}
......
...@@ -57,11 +57,7 @@ export default function Home() { ...@@ -57,11 +57,7 @@ export default function Home() {
paddingY={2} paddingY={2}
> >
<Grid2 container direction="column" spacing={2}> <Grid2 container direction="column" spacing={2}>
<InputField <InputField name="Decoded" value={formData.decoded} onChange={onInputChangeHandler} />
name="Decoded"
value={formData.decoded}
onChange={onInputChangeHandler}
/>
<Grid2 <Grid2
container container
alignItems="center" alignItems="center"
...@@ -73,19 +69,11 @@ export default function Home() { ...@@ -73,19 +69,11 @@ export default function Home() {
}} }}
> >
<Grid2 size={7}> <Grid2 size={7}>
<InputField <InputField name="Password" value={formData.password} onChange={onInputChangeHandler} />
name="Password"
value={formData.password}
onChange={onInputChangeHandler}
/>
</Grid2> </Grid2>
<Grid2 container justifyContent={{}}> <Grid2 container justifyContent={{}}>
<Grid2> <Grid2>
<Button <Button size="small" variant="contained" startIcon={<ArrowDownwardIcon />}>
size="small"
variant="contained"
startIcon={<ArrowDownwardIcon />}
>
<Typography <Typography
sx={{ sx={{
display: { xs: "none", md: "inline" }, display: { xs: "none", md: "inline" },
...@@ -100,9 +88,7 @@ export default function Home() { ...@@ -100,9 +88,7 @@ export default function Home() {
<Button <Button
size="small" size="small"
variant="contained" variant="contained"
startIcon={ startIcon={<ArrowDownwardIcon sx={{ transform: "rotate(180deg)" }} />}
<ArrowDownwardIcon sx={{ transform: "rotate(180deg)" }} />
}
> >
<Typography <Typography
sx={{ sx={{
...@@ -116,11 +102,7 @@ export default function Home() { ...@@ -116,11 +102,7 @@ export default function Home() {
</Grid2> </Grid2>
</Grid2> </Grid2>
<InputField <InputField name="Encoded" value={formData.encoded} onChange={onInputChangeHandler} />
name="Encoded"
value={formData.encoded}
onChange={onInputChangeHandler}
/>
</Grid2> </Grid2>
</Box> </Box>
</Container> </Container>
......
...@@ -6,7 +6,7 @@ import { CreateMessageDto } from './dto/create-message.dto'; ...@@ -6,7 +6,7 @@ import { CreateMessageDto } from './dto/create-message.dto';
export class MessageController { export class MessageController {
constructor(private readonly messageService: MessageService) {} constructor(private readonly messageService: MessageService) {}
@Post('encode') @Post('/encode')
encodeMessage(@Body() createMessageDto: CreateMessageDto): { encodeMessage(@Body() createMessageDto: CreateMessageDto): {
encoded: string; encoded: string;
} { } {
...@@ -15,7 +15,7 @@ export class MessageController { ...@@ -15,7 +15,7 @@ export class MessageController {
return { encoded }; return { encoded };
} }
@Post('decode') @Post('/decode')
decodeMessage(@Body() createMessageDto: CreateMessageDto): { decodeMessage(@Body() createMessageDto: CreateMessageDto): {
decoded: string; decoded: string;
} { } {
......
...@@ -4,10 +4,10 @@ import { Vigenere } from 'caesar-salad'; ...@@ -4,10 +4,10 @@ import { Vigenere } from 'caesar-salad';
@Injectable() @Injectable()
export class MessageService { export class MessageService {
encodeMessage(password: string, message: string): string { encodeMessage(password: string, message: string): string {
return Vigenere.Cipher(password).crypt(message); return Vigenere.Cipher(password.trim()).crypt(message);
} }
decodeMessage(password: string, message: string): string { decodeMessage(password: string, message: string): string {
return Vigenere.Decipher(password).crypt(message); return Vigenere.Decipher(password.trim()).crypt(message);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment