This commit is contained in:
rca 2024-07-19 01:27:52 +09:00
parent 44f25f942e
commit f8b0f39d44
2 changed files with 5 additions and 9 deletions

View File

@ -7,7 +7,7 @@ export const sendPing = async (): Promise<string> => {
};
export const loginWithCode = async (code: string): Promise<string> => {
const response = await api.post('/auth/login', { code });
const response = await api.post('/child/auth/login', { loginCode: code })
return response.data.accessToken;
}

View File

@ -16,7 +16,7 @@
</q-page>
</template>
<script setup>
<script setup lang="ts">
import { ref, computed } from 'vue';
import useStore from 'src/store';
import { loginWithCode } from 'src/api/apiService';
@ -29,13 +29,9 @@ const store = useStore();
const login = () => {
if (canLogin.value) {
loginWithCode(loginCode.value).then((response) => {
if (response.error) {
alert('ログインエラー: ' + response.error);
return;
}
store.commit('setToken', response.token);
store.commit('setLoggedIn', true);
loginWithCode(loginCode.value).then((accessToken) => {
store.commit('account/setToken', accessToken);
store.commit('account/setLoggedIn', true);
}).catch((error) => {
alert('ログインエラー: ' + error);
});