Skip to content

Commit

Permalink
[deploy] Add vlrt Nickname to redux (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
PMtHk authored Sep 12, 2023
2 parents 05fe356 + b8682e0 commit 1441cf7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/pages/register/Games.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { useSelector, useDispatch } from 'react-redux';

// mui
import { styled } from '@mui/system';
Expand All @@ -10,13 +10,16 @@ import MuiTypography from '@mui/material/Typography';

import { RootState } from 'store';
import { defaultAxios } from 'apis/utils';
import { registerActions } from 'store/register-slice';
import { GAME_ID } from 'types/games';
import InputLol from './InputLol';
import InputPubg from './InputPubg';
import InputOverwatch from './InputOverwatch';
import InputValorant from './InputValorant';

const Games = () => {
const navigate = useNavigate();
const dispatch = useDispatch();

const params = new URL(document.URL).searchParams;
const rsoAccessCode = params.get('code');
Expand All @@ -27,6 +30,17 @@ const Games = () => {
const response = await defaultAxios.post('/api/valorant/user/exist', {
code: rsoAccessCode as string,
});

if (response.data) {
const { gameName, tagLine } = response.data;

dispatch(
registerActions.SET_GAMES_WITH_ID({
id: 'valorant' as GAME_ID,
value: `${gameName}#${tagLine}`,
}),
);
}
};

if (rsoAccessCode) {
Expand Down

0 comments on commit 1441cf7

Please sign in to comment.