Skip to content

Instantly share code, notes, and snippets.

@sankita15
sankita15 / InvitationController.java
Last active December 27, 2019 10:34
Wedding Invitation
package com.example.backend.controller;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api")
public class InvitationController {
@PostMapping("/invite/{name}")
public String getConfirmationMessage(@PathVariable String name){
@sankita15
sankita15 / App.js
Created December 27, 2019 11:03
Redirect to invitation page
import React from "react";
import GuestInvitation from './component/GuestInvitation'
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
const App = () => (
<Router>
<Switch>
<Route exact path="/invite">
<GuestInvitation />
</Route>
@sankita15
sankita15 / GuestInvitation.js
Last active December 27, 2019 11:07
Guest Invitation Page
import React from "react";
export default class GuestInvitation extends React.Component {
constructor(props){
super(props);
this.state = {
name: '',
message: ''
@sankita15
sankita15 / build.gradle
Last active December 28, 2019 09:35
Gradle task
node {
version = '12.12.0'
yarnVersion = '1.15.2'
download = false
yarnWorkDir = file("${project.buildDir}/yarn")
nodeModulesDir = file("${project.projectDir}/../frontend")
<template>
<Child1 v-model:firstDropdownValue="firstDropdownValue"
v-model:secondDropdownValue="secondDropdownValue"/>
<Child2 />
<Child3 />
</template>
<script>
export default {
data() {
<template>
<!-- Dropdown 1-->
<div class="dropdown-container">
<div class="dropdown-title-container">
<label data-test="dropdown-title">Fruits</label>
</div>
<DropdownContainer :model-value="this.firstDropdownValue"
:options="this.firstDropdownOptions"
placeholder="Please select a fruit" @update:model-value="(event) =>
updateFirstDropdownValueAndLoadSecondDropdownOptions(event)">
<template>
<Child v-model="this.fruits" />
</template>
<script>
export default {
data() {
return {
fruits1: []
}
<template>
<Child v-model="this.fruits" />
</template>
<script>
export default {
data() {
return {
fruits: []
}
<template>
<div>{{this.modelValue}}</div>
</template>
<script>
export default {
props: {
modelValue: Array
}
}
methods: {
loadSecondDropdownOptions() {
this.secondDropdownValue = "";
this.secondDropdownOptions = this.response.fruits.find(fruit => fruit.name === this.firstDropdownValue)?.weights;
}
}