mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
21 lines
677 B
JavaScript
21 lines
677 B
JavaScript
import { CONSTANTS, getLocalSetting, setLocalSetting } from 'client/libs/userlocalManager';
|
|
|
|
export default function (to, from, next) {
|
|
const redirect = to.params.redirect;
|
|
|
|
switch (redirect) {
|
|
case 'paypal-success-checkout':
|
|
case 'paypal-success-subscribe': {
|
|
const appState = getLocalSetting(CONSTANTS.savedAppStateValues.SAVED_APP_STATE);
|
|
if (appState) {
|
|
const newAppState = JSON.parse(appState);
|
|
newAppState.paymentCompleted = true;
|
|
setLocalSetting(CONSTANTS.savedAppStateValues.SAVED_APP_STATE, JSON.stringify(newAppState));
|
|
}
|
|
window.close();
|
|
break;
|
|
}
|
|
default:
|
|
next({name: 'notFound'});
|
|
}
|
|
} |