Convert 'show' usage to Toast
This commit is contained in:
parent
642d1d8b3e
commit
3c38a57560
|
@ -6,7 +6,6 @@ import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
|
||||||
import { setSwUpdating } from 'soapbox/actions/sw';
|
import { setSwUpdating } from 'soapbox/actions/sw';
|
||||||
import * as BuildConfig from 'soapbox/build-config';
|
import * as BuildConfig from 'soapbox/build-config';
|
||||||
import { store } from 'soapbox/store';
|
import { store } from 'soapbox/store';
|
||||||
|
@ -16,6 +15,7 @@ import { default as Soapbox } from './containers/soapbox';
|
||||||
import * as monitoring from './monitoring';
|
import * as monitoring from './monitoring';
|
||||||
import * as perf from './performance';
|
import * as perf from './performance';
|
||||||
import ready from './ready';
|
import ready from './ready';
|
||||||
|
import toast from './toast';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
update: { id: 'sw.update', defaultMessage: 'Update' },
|
update: { id: 'sw.update', defaultMessage: 'Update' },
|
||||||
|
@ -43,14 +43,14 @@ function main() {
|
||||||
// https://github.com/NekR/offline-plugin/pull/201#issuecomment-285133572
|
// https://github.com/NekR/offline-plugin/pull/201#issuecomment-285133572
|
||||||
OfflinePluginRuntime.install({
|
OfflinePluginRuntime.install({
|
||||||
onUpdateReady: function() {
|
onUpdateReady: function() {
|
||||||
store.dispatch(snackbar.show('info', messages.updateText, {
|
toast.info(messages.updateText, {
|
||||||
actionLabel: messages.update,
|
actionLabel: messages.update,
|
||||||
action: () => {
|
action: () => {
|
||||||
store.dispatch(setSwUpdating(true));
|
store.dispatch(setSwUpdating(true));
|
||||||
OfflinePluginRuntime.applyUpdate();
|
OfflinePluginRuntime.applyUpdate();
|
||||||
},
|
},
|
||||||
dismissAfter: false,
|
duration: Infinity,
|
||||||
}));
|
});
|
||||||
},
|
},
|
||||||
onUpdated: function() {
|
onUpdated: function() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
Loading…
Reference in New Issue