meteor - inserting data to database gives error "insert failed: Method '/texts/insert' not found" -
i have other project broke somehow(i have no idea) , rebuilt app same file names , code , working fine. problem when go insert data database called texts
error insert failed: method '/texts/insert' not found
not know wrong because copied every line of code previous project , problem came wasn't there before. confuses me when create user accounts accounts.createuser()
works fine.
sendtext.js
import react "react"; import {texts} "./../api/text"; import {withrouter} 'react-router-dom'; import {meteor} "meteor/meteor"; import {accounts} "meteor/accounts-base" class sendtext extends react.component{ send(e){ e.preventdefault(); let message = this.refs.message.value; let name = accounts.user().username if(name != ""){ if(message){ texts.insert({ name, message }); this.refs.message.value = "" } } console.log(texts) } logoutuser(){ accounts.logout(); this.props.history.push("/login") } render(){ return( <div> <form classname="position-fixed sendinputs" onsubmit={this.send.bind(this)}> <input classname="inputmessage" placeholder="say something" type="text" ref="message"/> <button classname="chatbuttons">send</button> <button classname="chatbuttons" onclick={this.logoutuser.bind(this)}>logout</button> </form> </div> ) } } export default withrouter(sendtext);
text.js
import {mongo} "meteor/mongo"; export const texts = new mongo.collection("texts");
Comments
Post a Comment