This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for singly-linked list. | |
* struct ListNode { | |
* int val; | |
* ListNode *next; | |
* ListNode(int x) : val(x), next(NULL) {} | |
* }; | |
*/ | |
class Solution { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type doublyLinkedNode struct { | |
prev, next * doublyLinkedNode | |
key, val int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
class Dashboard extends Component { | |
.... | |
logout() { | |
let auth = new Auth(); | |
auth.logout(); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {Mutation} from 'react-apollo'; | |
import {updateTodo, getTodos} from '../../Queries'; | |
class UpdateToDo extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
id: this.props.todo_id | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import {Mutation} from 'react-apollo'; | |
import {deleteTodo, getTodos} from '../../Queries'; | |
class DeleteTodos extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
id: this.props.todo_id | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import {Mutation} from 'react-apollo'; | |
import {addTodo, getTodos} from '../../Queries'; | |
class AddTodos extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
task: "", | |
user: localStorage.getItem("user"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Query} from 'react-apollo'; | |
import {getTodos} from '../../Queries'; | |
import DeleteTodos from "./DeleteTodos"; | |
import UpdateToDo from "./UpdateToDo"; | |
class ListAllTodos extends Component { | |
render() { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
constructor(props) { | |
super(props); | |
const ACCESS_TOKEN = localStorage.getItem('access_token'); | |
this.client = new ApolloClient({ | |
uri: "https://himanshu-todo.herokuapp.com/v1alpha1/graphql", | |
headers: { | |
'Authorization': `Bearer ${ACCESS_TOKEN}`, | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gql from 'graphql-tag'; | |
export const getTodos = gql`{ | |
todo(order_by: []){ | |
id | |
task | |
user | |
completed | |
} | |
}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
... | |
class App extends Component { | |
render() { | |
const handleAuthentication = (nextState, replace) => { | |
if (/access_token|id_token|error/.test(nextState.location.hash)) { | |
const auth = new Auth(); | |
auth.handleAuthentication(); | |
} |