Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, { Component } from 'react';
import { UserProfile, UserRepos, Notes } from '../../components';
import { mixin } from 'core-decorators';
import ReactFireMixin from 'reactfire';
import Firebase from 'firebase';
import getGithubInfo from '../../util/helper';
@mixin(ReactFireMixin)
class Profile extends Component {
state = {
notes: ['1', '2', '3'],
bio: {
name: 'guoyongfeng'
},
repos: ['a', 'b', 'c']
}
componentDidMount(){
// 为了读写数据,我们首先创建一个firebase数据库的引用
this.ref = new Firebase('https://github-note-taker.firebaseio.com/');
// 调用child来往引用地址后面追加请求,获取数据
var childRef = this.ref.child(this.props.params.username);
// 将获取的数据转换成数组并且赋给this.state.notes
this.bindAsArray(childRef, 'notes');
import { mixin } from 'core-decorators';
import Article from 'models/article';
import PaginatedCollection from 'collections/paginated';
@mixin({
url: 'articles',
model: Article
})
export default class Articles extends PaginatedCollection {}
import Marionette from 'backbone.marionette';
import { mixin } from 'core-decorators';
import Session from 'services/session';
import DashboardItemView from 'views/dashboard/item';
import template from 'templates/dashboard/dashboard';
@mixin({
template,
className: 'jumbotron',
childViewContainer: '.articles-list',
childView: DashboardItemView,
model: Session.currentUser()
})
export default class DashboardView extends Marionette.CompositeView {}
import { mixin } from 'core-decorators';
import SessionModel from 'models/session';
@mixin({
urlRoot: 'comments',
validation: {
text: {
required: true
}
}
})
export default class Comment extends SessionModel {}
import { mixin } from 'core-decorators';
import Comment from 'models/comment';
import AppCollection from 'collections/app';
@mixin({
model: Comment
})
export default class Comments extends AppCollection {}