GithubHelp home page GithubHelp logo

whisky-taste's People

Contributors

keicy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

whisky-taste's Issues

画面リロード時の挙動改善

現状、どのURLを入力しても全てTOPにリダイレクトされてしまう。

原因

index.js にてロード時にTOPにリダイレクトさせているのが原因。

修正

下記のような感じ

  redirect(getURL()) // ここで入力されたURLに飛ぶようにする
const getURL = (url = location.href) => {
  const urllist = url.split(URL_ROOT)
  if (lngth === 1) '#'  // 初回アクセス用 (#がないとき)
  else urllist[1]
}

ルーティングにて不要なmountが走るのを排除

特に、投稿画面を閉じた時の画面遷移などで / に遷移したときに全てが mount しなおされてしまう(と思う)。
storeに isLoaded フラグを作成しておき、初回アクセス時にそれを t に設定、以降、t なので必要ないものは mount しない、という処理を追加する。

Herokuデプロイ用コード作成

要点

  • DB設定をどう上書きするか

ドキュメント

JSのビルドとPlayのビルドを両方実行するため、Nnde,Scalaの2つのビルドパックを適用することが必要。ただ、今回はうまくできなかったので、ひとまず単純にビルド済のbundle.jsをherokuにアップロードすることで対応した。 npm run buildsbt compile state を順に実施するタスクランナーを用意してやるほうが良いのかもしれない。

SBTにherokuプラグインがありそれを用いてデプロイする手順もあるらしいが今回は使っていない.

作業要点

  • heroku用の設定ファイル heroku.conf を追加しそれを利用
  • DBの接続設定には JDBC_DATABASE_XXX を利用
  • ensimeScalaVersion があるとなせかheroku でコンパイルが失敗するので削除

レビュー投稿API作成

  • 仮フォームから投稿したレビューデータがDBに保存され永続化されるようにする
  • そのためのAPIを作成する
  • また、このために必要な基本的なサーバサイド環境を整備する

TOP画面へのURL遷移時にページがリロードされてしまうのを排除

原因

URL遷移の window.location.href = this.store.data.url にて、代入するURLが絶対パス表記になってしまっているため Riot-router が認識せず、画面再読み込みになってしまっている。
全てのページヘの遷移について、下記のようなURLを指定するようにする。

  • href = '# ' // TOPへ
  • href = '#/whiskies' // ウイスキー一覧へ

DB導入

多分デフォルトでH2,SQLiteあたりが入っているはず。それを使う。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.