Comments (1)
ストレージから取得
const sessionQuestionsData = sessionStorage.getItem(STORAGE_KEY_QUESTIONS); // セッションストレージから質疑応答情報を取得
const [questions, setQuestions] = useState<Questions>(
sessionQuestionsData ? JSON.parse(sessionQuestionsData) : {} // セッションストレージに質疑応答情報があればそれを利用,なければ空オブジェクトを利用
);
ストレージに追加
const getQuestionsDataHandler = async () => {
await axios.get(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v2/questions/list`, {
params: { startIndex: startIndex },
})
.then((response: AxiosResponse<Questions>) => {
const { data } = response;
+ // セッションストレージに保存
+ sessionStorage.setItem(
+ STORAGE_KEY_QUESTIONS,
+ JSON.stringify({ ...questions, ...data })
+ );
setQuestions({ ...questions, ...data }); // stateを更新
Object.keys(data).length < 30 && setIsHasMore(false); //取得数が30件未満なら追加取得できないことを示す
})
.catch((error: AxiosError) => {
alert("サーバーでエラーが発生しました.");
console.error(error);
});
};
from susan-next.
Related Issues (20)
- [Request]デフォルトレイアウト
- [Request]回答者が教員か学生かわかるようにする
- [Request]チャットボットとの応答を再構成
- [BUG] IDtokenの有効期限切れの場合のみ自動再読み込みさせる
- [BUG] 本番環境にて回答通知(メール)が動作しない HOT 1
- [Request]未登録ユーザのページ遷移 HOT 1
- [Request]チャットボットの自動回答メッセージ
- [BUG] ログイン失敗しまくり HOT 3
- [BUG]質問詳細ページへのリダイレクトがされない HOT 1
- [Request]メッセージ送信中のローディング画面を追加
- [Request] HOW TO USE ページ
- [Request] 回答依頼をランダムな学生に配信
- [Request] 質問が投稿されていない場合の画面
- [BUG] ヘッダー画像の領域が広すぎる HOT 1
- [Request] 他の学生の質問をチャットで返す
- [BUG] 質問者以外への通知のトグルが動かない HOT 1
- [Request] ランダムアサインから質問者を除外する
- [Request]実験同意画面の修正
- [Request] 追加メッセージ通知を割り振られた協力者にも送る
- [Request]アンケートページの作成
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from susan-next.