mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-07-27 22:22:00 +00:00
Do not inject appupdated state or actions
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import { useCallback } from 'react';
|
||||
import { useAppDispatch, useAppSelector } from '../../store';
|
||||
|
||||
const { actions, reducer } = createSlice({
|
||||
name: 'shlink/appUpdates',
|
||||
@@ -12,3 +14,12 @@ const { actions, reducer } = createSlice({
|
||||
export const { appUpdateAvailable, resetAppUpdate } = actions;
|
||||
|
||||
export const appUpdatesReducer = reducer;
|
||||
|
||||
export const useAppUpdated = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const appUpdateAvailable = useCallback(() => dispatch(actions.appUpdateAvailable()), [dispatch]);
|
||||
const resetAppUpdate = useCallback(() => dispatch(actions.resetAppUpdate()), [dispatch]);
|
||||
const appUpdated = useAppSelector((state) => state.appUpdated);
|
||||
|
||||
return { appUpdated, appUpdateAvailable, resetAppUpdate };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user