Répare le bug firefox du localstorage

pull/399/head
Johan Girod 2018-10-11 17:23:28 +02:00
parent f9e5ce2e20
commit 1ae8196c5e
1 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import React, { Component } from 'react'
import { Trans, translate } from 'react-i18next'
import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import safeLocalStorage from '../../storage/safeLocalStorage'
import './Feedback.css'
import Form from './FeedbackForm'
import type { Tracker } from 'Components/utils/withTracker'
@ -30,10 +31,13 @@ const saveFeedbackOccurrenceInLocalStorage = ([name, path, rating]: [
string,
number
]) => {
localStorage.setItem(localStorageKey([name, path]), JSON.stringify(rating))
safeLocalStorage.setItem(
localStorageKey([name, path]),
JSON.stringify(rating)
)
}
const feedbackAlreadyGiven = (feedback: [string, string]) => {
return !!localStorage.getItem(localStorageKey(feedback))
return !!safeLocalStorage.getItem(localStorageKey(feedback))
}
class PageFeedback extends Component<Props, State> {